Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Subnumber
Time Limit: 1000MSMemory Limit: 30000K
Total Submissions: 1106Accepted: 130

Description

George likes arithmetics very much. Especially he likes the natural numbers series. His most favourite thing is the infinite sequence of digits, which results as the concatenation of all natural numbers in ascending order. The beginning of this sequence is 1234567891011121314... Let us call this sequence S. Then S[1] = 1, S[2] = 2, ..., S[10] = 1, S[11] = 0, ... , and so on.
George takes a sequence of digits A and wants to know when it first appears in S. Help him to solve this difficult problem.

Input

The first line of the input file contains A - the given sequence of digits. The number of digits in A does not exceed 200. There are no spaces in the input file.

Output

Output file must contain the only number - the least k such that A[1] = S[k], A[2] = S[k+1], ... A[len(A)] = S[k + len(A) – 1], where len(A) denotes the length of A (i.e. the number of digits in it).

Sample Input

101

Sample Output

10

Source

Northeastern Europe 2001, Northern Subregion

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator