Problems > Digits on the Pages

Digits on the Pages

Difficulty: 1200 2000 ms 128 MB

math

A book's pages are numbered 1..N. How many DIGITS are printed in total?

Input: one integer N.

Output: the total digit count.

Constraints:

  • 1 ≤ N ≤ 1018

Sample Tests

Input 1
13
Output 1
17
Input 2
9
Output 2
9

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.