Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

SQUAREV - Revenge of the squares

I think it's time to not only solve problems but also create some.
So here is my first attempt:
Given a number calculate the product N of their digits bigger than zero. The output is the number R of different presentations of N in the form A*A+B*B with A and B being positive integers including zero. 1*1+2*2 and 2*2+1*1 are not different presentations. So for input 5 the output is 1.

See also this similar task.

Input

One hundred tests with one positive integer < 10^20.

Output

Print the illustrated above number R for each test.

Example

Input:
5
7
78185824586267361855 Output: 1
0
3

Added by:HWK
Date:2011-02-27
Time limit:2.394s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP C99 JAVA PYTHON PYTHON3 PY_NBC

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.