eolymp
bolt
Try our new interface for solving problems
Problems

Rashad is trying to sleep

Rashad is trying to sleep

Rashad has problems with sleeping . The sleeping it is most important for the scientists and programmers,because they brain works a lot . Huseyn told Rashad very interesting technique ,that will help him to sleep : At night Rashad must to find the K-th interesting number. Interesting number it is that number that the last digits of his square identical for all digits of this number . For example : 376 is interesting number ,because 376*376= 141376 . And you can see the last digits of 141376 is 376 and they are identical . While Rashad was trying to find K-th interesting number ,he have gone to his sweet dream . Can you find the K-th interesting number ?

Input :

Input contains one integer K (1 <= K <= 1000) .

Output:

Print the answer on this problem.

Time limit 1 second
Memory limit 64 MiB
Input example #1
1
Output example #1
0
Input example #2
2
Output example #2
1
Input example #3
3
Output example #3
5
Input example #4
7
Output example #4
376
Source Selection for Azerbaijani Schoolers 09 November , 2020