| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 1142 | 931 | 851 | 82.782% |
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