Fibonacci

Time limit: 200 ms
Memory limit: 256 MB

Dr. Fibonacci is modeling the bacteria population growth using a famous sequence. Initially, a bacterium is placed inside a test tube. There will be 11 bacterium in the first minute, 22 bacteria in the second minute, 33 in the third minute, 55 in the fourth minute and so on. At the end of the minute nn, the number of bacteria will be equal to the number of bacteria in minute n2n - 2 plus the number of bacteria in minute n1n - 1.

Dr. Xtreme wants Dr. Fibonacci to use the same model with an enhancement to model the human population growth. Dr. Xtreme wants to enhance the model by including a disaster scenario where most humans are destroyed. If there is a disaster in generation mm, then only the number of humans in that generation modulo 1010 will survive. You goal is develop the model with the disaster scenario, so that we can compute how many humans will survive after the disaster occurs.

Standard input

Input begins with a single number tt (1t1001 \leq t \leq 100), which denotes the number of test cases.

On the following tt lines there will be a single integer mm (1m1091 \leq m \leq 10^9) which indicates the generation where the disaster occurs for the specific test case.

Please note that there will be only one disaster per test case.

Standard output

For each test case, output a single integer per line indicating the number of humans who survived the disaster.

Constraints and notes

  • 1t1001 \leq t \leq 100
  • 1m1091 \leq m \leq 10^9

InputOutputExplanation
3
2
4
10
2
5
9

There are three test cases. At the end of 22nd, 44th and 1010th generation, there will be 22, 55 and 8989 humans respectively. When the disaster occurs, there will be 22, 55 and 99 humans left.

Authenticate to use the workspace

Log In
Sign Up
Forgot Password?
or connect with