시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 670 155 125 33.156%

문제

구간 [a,b]의 자리 합이란 그 구간에 포함되는 모든 숫자의 각 자리를 합한 것이다. 예를 들어, [28,31]의 자리합은 아래와 같다.

2+8 + 2+9 + 3+0 + 3+1 = 28

두 수 a와 b가 주어졌을 때, [a,b]의 자리 합을 구하는 프로그램을 작성하시오. 

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. T는 최대 100이다. 각 테스트 케이스는 한 줄로 이루어져 있고, a와 b가 주어진다. (0 ≤ a ≤ b ≤1015)

출력

각 테스트 케이스에 대해서, [a,b]의 자리 합을 출력한다.

예제 입력 1

3
0 10
28 31
1234 56789

예제 출력 1

46
28
1128600

힌트

W3sicHJvYmxlbV9pZCI6IjU0MjUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM3OTBcdWI5YWNcdWQ1NjkiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YWQ2Y1x1YWMwNCBbYSxiXVx1Yzc1OCBcdWM3OTBcdWI5YWMgXHVkNTY5XHVjNzc0XHViNzgwIFx1YWRmOCBcdWFkNmNcdWFjMDRcdWM1ZDAgXHVkM2VjXHVkNTY4XHViNDE4XHViMjk0IFx1YmFhOFx1YjRlMCBcdWMyMmJcdWM3OTBcdWM3NTggXHVhYzAxIFx1Yzc5MFx1YjlhY1x1Yjk3YyBcdWQ1NjlcdWQ1NWMgXHVhYzgzXHVjNzc0XHViMmU0LiBcdWM2MDhcdWI5N2MgXHViNGU0XHVjNWI0LCBbMjgsMzFdXHVjNzU4IFx1Yzc5MFx1YjlhY1x1ZDU2OVx1Yzc0MCBcdWM1NDRcdWI3OThcdWM2NDAgXHVhYzE5XHViMmU0LjxcL3A+XHJcblxyXG48cD4yKzggKyAyKzkgKyAzKzAgKyAzKzEgPSAyODxcL3A+XHJcblxyXG48cD5cdWI0NTAgXHVjMjE4IGFcdWM2NDAgYlx1YWMwMCBcdWM4ZmNcdWM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