MDIGITS2 - First Number

no tags 

A sequence of digits is obtained by writing down decimal representations of all integers starting with 1 and continuing up to a certain number N consecutively like this:

12345678910111213141516171819202122 ...

etc. Write a program that will compute the position of the first occurrence of the decimal representation of number N in the sequence.

Input

The first and only line of the input contains the integer N, 1 ≤ N ≤ 100,000.

Output

The first and only line of output should contain the position of the first occurrence of the decimal representation of number N in the sequence.

Sample

input 
15 
 
output 
20

input 
34 
 
output 
3 

input 
142 
 
output 
73 


Added by:psetter
Date:2009-04-25
Time limit:0.200s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:COI 04