| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 1059 | 872 | 796 | 83.789% |
The factorial of $N,ドル written as $N!,ドル is defined as the product of all the integers from 1ドル$ to $N$. For example, 3ドル! = 1 \times 2 \times 3 = 6$.
This number can be very large, so instead of computing the entire product, just compute the last digit of $N!$ (when $N!$ is written in base 10ドル$).
The first line of input contains a positive integer 1ドル \leq T \leq 10,ドル the number of test cases. Each of the next $T$ lines contains a single positive integer $N$. $N$ is at most 10ドル$.
For each value of $N,ドル print the last digit of $N!$.
3 1 2 3
1 2 6
2 5 2
0 2