Under construction

Still being built. Things may change

Escalator

Interview

Time limit1sMemory limit512 MB

Summary
Given n, sum the decimal digit counts of the numbers 1, n, and every multiple of 10 up to n.
Level

Medium4 of 10

Topics
Math, Implementation, Number theory
Solved
No attempts yet

Problem

A new metro station is opening in Saint Petersburg, and an escalator must be produced for it. The escalator consists of nn steps, numbered with the integers from 11 to nn. By tradition, the step numbers are written on the steps whose numbers are multiples of ten, as well as on the first and the last step. Writing a number uses the same amount of paint for each digit written.

To calculate the amount of paint needed, you have to know how many digits will be written. Write a program that determines the total number of digits used in the numbers of the labeled steps.

Input

The input file contains a single integer nn, the number of steps of the escalator (1≤n≤10121 \le n \le 10^{12}).

Output

Output the total number of digits in the numbers of the labeled steps.

Hint

In the first example, numbers are written on steps 1, 10, 20; in the second, on 1, 10, 20, 23.

Examples2

  1. Example 1

    Input
    20
    
    Expected output
    5
    
  2. Example 2

    Input
    23
    
    Expected output
    7