The Golden Pentagon

The plane can be tiled by a geometric progression of equilateral triangles, with a polynomial charac- teristic equation, as shown in the figure below. You can assume the following things: a) The width of the black borders of the triangles are negligible b) The geometric progression of the triangles is forming pentagons of different sizes. You can see in the picture above that the triangles are numbered 1, 2, 3, ..., etc. In this problem your job is two fold: a) Find out the length of a side of the I-th triangle if the length is less than 1000000000 and print its nearest smaller round number (L). b) If the length of a side of the I-th triangle is greater than or equal to 1000000000 then print how many digits L has in decimal number system. The meaning of L is given above. Input The input file contains N (N ≤ 7300) lines of input. Each line contains a floating point number S (0 ≤ S ≤ 10000) which is the length of a side of the first triangle, and an integer I (1 ≤ I < 100000000). The meaning of I is described before. Input is terminated by end of file. Output For each line of input produce one line of output. This line contains a single integer L or D. Here L indicates the length of a side of I-th triangle rounded down to the nearest integer. If L is not less than 1000000000 then you should output D instead of L, where D is the number of digits in L.

2/2 Sample Input 11 12 13 14 15 1 10 1 25 1 10000 Sample Output 1 1 1 2 3 12 853 1222