시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB73494195.349%

문제

It is easy to compute the sum of the numbers in the sequence from 0 to n with the formula n*(n+1)/2. That is: 0 + 1 + 2 + .... + n = n*(n+1)/2

This problem is a bit harder: what about the sum of the digits in the sequence [0, 1, ..., n]?

Write a program that computes the sum of the digits that can be found when counting from 0 to n.

For n = 15 we want to sum the digits that appear in the sequence [0, 1, 2, ..., 14, 15].

The result is: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 0 +1 + 1 + 1 + 2 + 1 + 3 + 1 + 4 + 1 + 5 = 66

입력

A single line with an integer n (1 ≤ n ≤ 1016)

출력

A single line with the sum of digits in the sequence [0, 1, ..., n-1, n]

예제 입력 1

15


예제 출력 1

66


예제 입력 2

9935125239801570


예제 출력 2

714619374344308434


예제 입력 3

1000


예제 출력 3

13501


예제 입력 4

83


예제 출력 4

678