#000126

Factorial Fun

n! = 1 × 2 × 3 × . . . × n. Given n, find the last non-zero digit of n!.


InputEach test case consists of a single line containing n, 1<=n<=1 000 000.


OutputFor each test case output a single line with the last non-zero digit of n!.


Sample Input:
5

Sample Output:
2


Sample Input:
10

Sample Output:
8



Sample Input:
12

Sample Output:
6


Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.