Digit Sum

View as PDF

Points: 15
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Assembly, Brain****, C, C++, COBOL, Fortran, Pascal

His Imperial Majesty, the Dark Lord and Paramount Leader of Dmojistan knows that contest programmers really do not like to implement arbitrary precision integers. My Dark Master the Lord quantum knows this because a lot of contest problems simply ask for output in . Now, since My Dark Master the Lord quantum is a sadistic person, My Dark Master the Lord quantum would like to force you to implement such. Of course, you might be able dodge My Dark Master the Lord Quantum's torture curse, instead enraging My Dark Master the Lord Quantum.

The problem is simple: given the integers () and (, except in which case ), find the sum of digits of the integer in decimal. The resulting integer whose sum of digit you are to calculate is guaranteed to be an integer. Since you contest programmers are all so fond of , the output will be .

Since this is a pretty trivial task anyway, you can obviously fit your submission into 512 bytes. If not, well, a zero awaits you.

Input Specification

The first line will be the number , the number of cases to follow. Each case will be on its own line, containing the integers and for that case, in that order.

Output Specification

For each case, output the sum of decimal digits of (which is an integer), in .

Sample Input

4
4 9223372036854775808
10 10006998372017242112
19 11728112301486637056
63 13779283480589161437

Sample Output

7
4
36
96

Explanation

• .
• .
• .
• , adding all digits result in 96.