Blessing from Fab
#描述#
It is said that someone received the blessing from Fibonacci when he was dreaming. Fibonacci gave a hint to find the answer to the life, universe and everything in the Fibonacci sequence.
The well-known Fibonacci sequence is defined as following:
F(0)=f(1)=1
F(n)=F(n-1)+f(n-2) n>1
We regards n as the index of the Fibonacci number F(n).
Fibonacci gives only some digits of a Fibonacci number. You are very interesting about this story and start to study on the Fibonacci numbers. To start your research, you decide to write a program to determine the smallest index of the smallest Fibonacci number that ends with the given digits.
#格式#
##输入格式##
The input file contains multiple test cases. The first line of input contains only one integer denoting the number of test cases.
For each case, input contains a single line with no more than five digits which is the request of Fibonacci.
##输出格式##
For each test case, output a single integer that is the smallest index of the smallest Fibonacci number that ends with the given digits. If such Fibonacci number does not exist, output -1 instead. See the sample output for further output format information.
#样例1#
##样例输入1##
2
2
3
##样例输出1##
2
3
#限制#
200ms
32768KB
#提示#
参照斐波追溯数
#来源#
ACM2011亚洲预赛上海赛区热身题