[Home|Training|Problems|Contests|C Language] | [Login|Register] |
Problems Status Rank Statistics |
Problem E
Calculate the Sum
Time Limit: 1000ms
Memory Limit: 65536kb Description
As you all know, MOD is a mathematical operatio. Giving you two numbers n,m(0 < m,n <= 10^10001),Your task is to calculate the sum of every digit of m MOD every digit of n. We can guarantee that there is no zero in digits of n.
Input
The first line, a integer T, representing T test cases blew.(T<=10).In each case, the first line is the integer m, the second line is the integer n. Output
Print the sum of every digit of m MOD every digit of n.
Sample Input
1 13 21 Sample Output
2 Hint
1%2 + 3%2 + 1%1 + 3%1 = 2
|