P10918 [HackerEarth] just shut up
普及
题目描述

Atish is very talkative. He just doesn't stop speaking. Unfortunately for those around him, he's also a maths wiz, and befuddles anyone who dares speak to him. Annoyed with this, Souradeep asked him to shut up, to which Atish replied,
Take a number, x, find its factorial, remove the zeroes, and find the last digit. Call this the "Atish digit". When you can do this fast enough to satisfy me, I'll shut up.
Now Souradeep is not a mathlete. So he's come to you for help. Can you help him shut Atish up?

EDIT
Maximum number of test cases - 500,
x<10000

SAMPLE INPUT
5

0
1
24
13
87

SAMPLE OUTPUT
1
1
6
8
4

输入格式

见题面

输出格式

见题面

样例输入
5 0 1 24 13 87 SAMPLE
样例输出
1 1 6 8 4