2334: Calculate the Sum

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:142 解决:38

题目描述

As you all know, MOD is a mathematical operatio. Giving you two numbers n,m0 < 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. 

输入

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. 

输出

Print the sum of every digit of m MOD every digit of n.

样例输入 复制

1
13
21

样例输出 复制

2

提示

1%2 + 3%2 + 1%1 + 3%1 = 2

来源/分类