Recently, Nick has been assigned the task of collecting money for the school fair,their are K houses in his town and they are numbered from 1 to K.
The i th house will give i^x (1<=i<=K) money,where x is a positive integer.
Nick is a greedy person and he will divide the total sum collected with 10^z (z>=0) such that GCD(10^z,sum)=10^z.Find the greatest value of z that he can achieve.
INPUT:
Each line consists of two integers K and x.Input will terminate with EOF .
OUTPUT:
Output maximum value of z for every test case.
Constraints:
test case <10
1<=K<=100
1<=x<=10^6
2 2 4 3
0 2
For 1st test case totat sum = 1^2+2^2=5,thus z is 0 and gcd(10^0,sum)=10^0.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor