This problem is a programming version of Problem 171 from projecteuler.net
For a positive integer , let be the sum of the squares of the digits (in base ) of , e.g.
Find the sum of all , , such that is a perfect square modulo .
The first line of input contains the only integer .
Output the only integer which is the answer for the problem.
Sample Input 0
Sample Output 0
You have to sum up following numbers: .