Problem F
The Golden Pentagon
Input: This program has no input
Output: standard output
Time Limit: 8 seconds

The plane can be tiled by a geometric progression of equilateral triangles, with a polynomial characteristic 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 no of digit in L.

Sample Input

1 1

1 2

1 3

1 4

1 5

1 10

1 25

1 10000

 

Sample Output
1

1

1

2

3

12

853

1222


(Problem Setter: Shahriar Manzoor, CSE Dept, Southeast University, Dhaka)

 

“It's nice to be important, but it's more important to be nice.”