101952: [AtCoder]ABC195 C - Comma

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

Problem Statement

When Takahashi writes an integer, he uses a comma every third digit from the right. For example, $1234567$ is written as 1,234,567, and $777$ is written as 777.

How many commas will be used in total when he writes each integer from $1$ through $N$ once?

Constraints

  • $1 \leq N \leq 10^{15}$
  • $N$ is an integer.

Input

Input is given from Standard Input in the following format:

$N$

Output

Print the total number of commas.


Sample Input 1

1010

Sample Output 1

11

No comma is used in writing $999$ or smaller numbers. One comma is used in writing each of the numbers from $1000$ through $1010$.

Thus, $11$ commas are used in total.


Sample Input 2

27182818284590

Sample Output 2

107730272137364

Input

题意翻译

#### 题目大意 写一个整数时,可以从右开始每隔三位写一个逗号。如 $1234567$ 写作$1,234,567$,$777$直接写作$777$。 如果我们写下$1$到$N$之间的所有整数,一共要用多少个逗号? #### 输入格式 一行一个整数$N$。 #### 输出格式 一行,总共需要的逗号的数量。

加入题单

上一题 下一题 算法标签: