Mastermind

View as PDF

Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type

Mastermind

I'm thinking of a secret number between 1 and 100. What is it?

Okay, okay, fine. You tell me some number X, and I'll tell you whether or not my secret number is divisible by X.

With the clues I give you, try and figure out what my secret number is!

Input

The first line of each test case consists of an integer N (1 \leq N \leq 100), the number of clues you've been given.

The next N lines are in the form X Yes/No indicating that my secret number is or isn't divisible by X (1 \leq X \leq 100).

For example, 3 Yes indicates that my secret number is divisible by 3.

Output

For each test case, output the secret number I'm thinking of.

Example

Input
3
12 Yes
8 No
5 Yes
Output
60
  • At first, any number from 1 to 100 can be my secret number.

  • After clue #1, my secret number could be 12, 24, 36, 48, 60, 72, 84 or 96.

  • After clue #2, my secret number could be 12, 36, 60 or 84.

  • After clue #3, my secret number can only be 60.


Comments

There are no comments at the moment.