Time limit
0.3s
Memory limit
128 MB
Given a positive integer N, write N! in decimal notation and find the rightmost digit that is not 0.
For example, 4! = 24, so the answer is 4. Also, 5! = 120, so the answer is 2.
The first line contains a positive integer N. N is at most 20,000.
Output one digit: the last nonzero digit of N!.