Last Factorial Digit
면접 대비시간 제한1초메모리 제한1024 MB
N이 10 이하인 최대 10개의 입력에 대해 N!의 일의 자리 숫자를 출력한다.
문제
The factorial of , written as , is defined as the product of all the integers from to . For example, .
This number can be very large, so instead of computing the entire product, just compute the last digit of (when is written in base ).
입력
The first line of input contains a positive integer , the number of test cases. Each of the next lines contains a single positive integer . is at most .
출력
For each value of , print the last digit of .