The Nth Fibonnaci
Submissions: 2648   Accuracy:

41.46%

  Difficulty: Easy   Marks: 2

Given a positive integer N, write a program to find the last digit of the N'th term from the Fibonnaci series and print it.

Input
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. 
The first line of each test case contains a positive integer N.


Output
Print out the last digit of N'th Fibonacci number.


Constraints
1 <= T <= 100
0 <   N  <= 1000

Examples 

Input
4
1
5
14
300

Output
1
5
7
0

** For More Input/Output Examples Use 'Expected Output' option **

Author: Rohan Malhotra


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.