323. Last Fibo

Problem Statement:
Mohamed Yasser is a child in primary school, he loves math so much, one day he learns about Fibonacci series; a mathematical sequence that starts with 0 and 1, each of the next elements is the sum of the two previous ones. On the first day of a holiday, Yasser wrote the first 1,000 terms of the sequence on a paper. The next day, he woke up and saw the paper split vertically and only one part exists which contains the last three digits of the Fibonacci term. Mohamed Yasser want to know the possible value of x where the last three digits of F(x) are given.

Input Format:
The first line contains one integer T which represents the number of test cases where (1 ≤ T ≤ 1, 000). Each test case is represented on a single line that contains three digits.

Output Format:
If there isn't any Fibonacci number ends with these digits print "These digits seem to be invalid", else print all Xs in the following format: The last three digits of F(x0), F(x1), .. are [the last three digits]

Sample Input:
2 708 709

Sample Output:
These digits seem to be invalid The last three digits of F(691), F(809) are [709]

 Added by: hossamyosef Added at: 2014-11-11 15:32:50 UTC Time Limit: 2 seconds Partial score: No Source: ACM Jordanian Collegiate Programming Contest 2014