This is an interactive problem.
Alice has a black box which works with integers modulo m=109+7. If a user types a number x on the keyboard of the box, the screen shows the number equal to the value of the polynomial p(x)=(a_dxd+a_d−1xd−1+…+a_1x1+a_0)modm. The degree d of the polynomial is unknown, as are its coefficients a_i. It is only known that 0≤d≤10 and a_d=0.
Alice can type several numbers x and learn the values of the polynomial for these numbers. Help her find the degree d of the polynomial. She can input an x at most d+3 times.
In each test, the degree and the coefficients of the polynomial p(x) are chosen and fixed in advance.
In the example, which is also the first test in the testing system, p(x)=x2+1,000,000,005. All other tests were created as follows: first, the degree d was chosen (0≤d≤10), and after that, one of the polynomials of such degree was chosen as p(x) uniformly at random.