P25125 [AtCoder] Leading 1s
普及
题目描述

Problem Statement

For an integer x, let f(x) be the number of leading ones in the decimal notation of x.
For example, we have f(1)=1,f(2)=0,f(10)=1,f(11)=2,f(101)=1.
Given an integer $N, find f(1)+f(2)+\cdots+f(N)$.

Input

Input is given from Standard Input in the following format:
N

Output

Print the answer.

Constraints

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

Sample Input 1

11

Sample Output 1

4

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

Sample Input 2

120

Sample Output 2

44

Sample Input 3

987654321

Sample Output 3

123456789

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
11
样例输出
4