By Ricardo Martins, IFSULDEMINAS Brazil
Chagas is a boy who loves to eat boiled eggs, but he hates math. He hates exponentiation and for some reason does not correctly calculate operations involving the number 7. Knowing this, his friend Caco decided to make a challenge: he wants Chagas to calculate the Nth power of 7 and say the last digit of that power. If Chagas hit all The questions, I would get 7 boiled eggs. For example, where N = 2, the result would be 9, because 72 = 49. The problem is that, depending on the value of N, the result of exponentiation can be a very large number. Without ideas, Chagas decided to ask for his help.
Write a program that, given a number, calculate the last digit of the value of 7 raised to that number.
The entry consists of several instances. The first line of the entry contains an integer T indicating the number of instances. Each instance is composed of only one row, which contains the integer N (0 ≤ N ≤ 109).
For each instance in the entry, print a line containing an integer, the last digit of 7N.
|Input Sample||Output Sample|