AtCoder Regular Contest 127
A
Leading 1s
AtCoder
⌀ 808
原题
←B →
翻译中…

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)$.

翻译中…

Constraints

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

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
11
Output #1
4
We have $f(2)=f(3)=\cdots =f(9)=0$. The answer is $f(1)+f(10)+f(11)=4$.
Input #2
120
Output #2
44
Input #3
987654321
Output #3
123456789
题目信息
题号
arc127_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。