Amount
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
The numbers from 1 to n are written on a paper in increasing order. Between each pair of adjacent digits (and before the first) alternately + and - are placed. Find the resalt of this expression.
For example, if n = 12, then it is easy to see that the sum equals to five:
+ 1 - 2 + 3 - 4 + 5 - 6 + 7 - 8 + 9 - 1 + 0 - 1 + 1 - 1 + 2 = 5
Input
The first line contains an integer n (1 ≤ n ≤ 10^15).
Output
Print the result of the given expression
Examples
Input #1
Answer #1
Submissions 453
Acceptance rate 8%