시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 128 MB 62 36 27 62.791%

문제

두 정수의 거리는 각 자리의 차이의 절댓값의 합으로 정의할 수 있다. 예를 들어, 4561과 3278의 거리는 |4 - 3| + |5 - 2| + |6 - 7| + |1 - 8| = 12 이다. 두 정수의 길이가 일치하지 않는 경우에는 앞에 0을 붙인다. 따라서, 32와 5678의 거리는 |0 - 5| + |0 - 6| + |3 - 7| + |2 - 8| = 21이 된다.

두 정수 A와 B가 주어졌을 때, 구간 [A,B]에 포함되는 모든 쌍의 거리의 합을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 두 정수 A와 B가 주어진다. (1 ≤ A ≤ B ≤ 1050000)

출력

첫째 줄에 구간 [A,B]에 포함되는 모든 쌍의 거리의 합을 출력한다. 답이 매우 커질 수 있으므로 1,000,000,007로 나눈 나머지를 출력한다.

예제 입력 1

288 291

예제 출력 1

76

힌트

(288, 289) = 1, (288, 290) = 9, (288, 291) = 8, (289, 290) = 10, (289, 291) = 9, (290, 291) = 1. 각 쌍을 두 번씩 더하면 2 * (1 + 9 + 8 + 10 + 9 + 1) = 76.

W3sicHJvYmxlbV9pZCI6Ijk2MjkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWI0NTAgXHVjODE1XHVjMjE4XHVjNzU4IFx1YWM3MFx1YjlhYyIsImRlc2NyaXB0aW9uIjoiPHA+XHViNDUwIFx1YzgxNVx1YzIxOFx1Yzc1OCBcdWFjNzBcdWI5YWNcdWIyOTQgXHVhYzAxIFx1Yzc5MFx1YjlhY1x1Yzc1OCBcdWNjMjhcdWM3NzRcdWM3NTggXHVjODA4XHViMzEzXHVhYzEyXHVjNzU4IFx1ZDU2OVx1YzczY1x1Yjg1YyBcdWM4MTVcdWM3NThcdWQ1NjAgXHVjMjE4IFx1Yzc4OFx1YjJlNC4gXHVjNjA4XHViOTdjIFx1YjRlNFx1YzViNCwgNDU2MVx1YWNmYyAzMjc4XHVjNzU4IFx1Y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