TSHOW2 - Fibonacci brain

no tags 

Ravi is a student who loves Fibonacci numbers. He used to think of Fibonacci numbers all the time. Suddenly he asked his friend Rama whether he can find Nth Fibonacci number. Rama said 'No'. Ravi started laughing. Ravi then asked Rama whether he can at least find the last digit of Nth Fibonacci number. Thinking for a while, Rama said 'Yes'. Help Rama finding the last digit of Nth Fibonacci number. Note : The series starts from 0 (0, 1, 1, 2, 3, ...)

Input

First line consists of an integer t (t<=1000) denoting the number of test cases that follow.

The following t lines consist of an integer N (1<=N<=10^15).

Output

Output t lines consisting of the last digit of Nth Fibonacci number.

Example

Input:
3
1
2
5

Output: 0
1
3

hide comments
Alex: 2012-04-13 22:51:22

Input: 10^15
Output: 7

Last edit: 2012-04-18 12:03:34
! include(L.ppt): 2012-04-13 09:45:24

@ Tarun u r correct this is mine fifth of same type.....:P

Tarun Chabarwal: 2012-04-12 18:34:11

many problems on this concept has been added recently..


Added by:Pandian
Date:2012-04-12
Time limit:0.100s-1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own problem