401737: GYM100519 I Interactive Primes Guessing

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Interactive Primes Guessingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The jury has chosen the numbers X0 and P (1 ≤ X0 < P ≤ N, P is a prime number). You are given the number N: the upper limit for P.

Your task is to guess the number P.

In order to do that, your program will ask the questions in the form of Ai (2 ≤ Ai ≤ N, Ai is a prime number) where i = 1, 2, ... is the index of the question.

After each question, the answer comes. In case the i-th question does not guess the number P, the jury calculates and returns your the result of comparison of Xi and Xi - 1 (">", "<" or "=").

Your program must guess the number P by asking not more than 42 questions.

Input

The first line of input contains a single integer N (2 ≤ N ≤ 3·105). The answers for the questions of your program are given on separate lines.

If the i-th question is the number P, then the string "OK" is given as an answer. In other cases, the result of comparison between Xi and Xi - 1 is returned. If Xi > Xi - 1 then the answer is ">", if Xi < Xi - 1 then the answer is "<", otherwise the answer is "=".

After receiving the answer "OK", your program must stop sending questions.

Output

Your program must output a single question on a separate line. Each question must consist of a single prime number Ai (2 ≤ Ai ≤ N).

ExamplesInput
100
<
>
>
>
>
>
OK
Output
29
43
23
17
29
17
73
Note

Among all possible pairs (X0, P) where P ≤ 100, only the pair (41, 73) satisfies the following equations for the questions given in the first example test: X1 < X0, X2 > X1, X3 > X2, X4 > X3, X5 > X4, X6 > X5 (X0 = 41, X1 = 21, X2 = 27, X3 = 37, X4 = 45, X5 = 64, X6 = 66).

The pipe from your program to the interactor program and the pipe back have limited size. Your program must read from the standard input to avoid deadlock. Deadlock condition is reported as "Time Limit Exceeded".

To flush the standard output stream, use the following statements:

In C, use fflush(stdout);

In C++, use cout.flush();

In Java, use System.out.flush();

In Python, use sys.stdout.flush().

If your program receives an EOF (end-of-file) condition on the standard input, it MUST exit immediately with exit code 0. Failure to comply with this requirement may result in "Time Limit Exceeded" error.

加入题单

算法标签: