#arc127a. [arc127_a]Leading 1s

[arc127_a]Leading 1s

Problem Statement

For an integer xx, let f(x)f(x) be the number of leading ones in the decimal notation of xx. For example, we have f(1)=1,f(2)=0,f(10)=1,f(11)=2,f(101)=1f(1)=1,f(2)=0,f(10)=1,f(11)=2,f(101)=1.

Given an integer NN, find f(1)+f(2)+cdots+f(N)f(1)+f(2)+\\cdots+f(N).

Constraints

  • 1leqNleq10151 \\leq N \\leq 10^{15}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer.


Sample Input 1

11

Sample Output 1

4

We have f(2)=f(3)=cdots=f(9)=0f(2)=f(3)=\\cdots =f(9)=0. The answer is f(1)+f(10)+f(11)=4f(1)+f(10)+f(11)=4.


Sample Input 2

120

Sample Output 2

44

Sample Input 3

987654321

Sample Output 3

123456789