Lyra Belacqua is a very gifted girl. She is one of a very small set of people capable of reading an alethiometer, more commonly known as The Golden Compass. It has one specific use: to tell the truth. The name in fact, is derived from "Aletheia" meaning truth, and "-ometer", meaning "measuring device".

The alethiometer had four needles, out of which the user would direct three of them to lie over symbols on the face of the device to ask a question. The fourth needle then swung into action and pointed to various symbols one after another, thus telling the answer.

For this problem, consider the alethiometer consisting of symbols : digits '0'-'9' and letters 'A'-'Z'. Learned scholars were debating the age of the Universe, and they requested Lyra to find out the age from the alethiometer. Having asked the question, the fourth needle started spouting out symbols, which Lyra quickly recorded. In that long string of characters, she knows that some substring corresponds to the age of the Universe. She also knows that the alethiometer could have wrongly pointed out atmost one digit (0-9) as a letter (A-Z). She then wonders what is the maximum possible age of the Universe.

Given the set of symbols the alethiometer pointed out, help her find the maximum age of the Universe, which could correspond to a substring of the original string with atmost one letter changed.

Note: We consider a substring to be a contiguous part of the string S 

Also, the alethiometer wrongly reports only a letter. All the digits remain as they are.

-----Input-----

Each input consists of a single string S which is what Lyra recorded from the fourth needle's pointing.

-----Output-----

Output one number, the maximum possible answer.

-----Constraints-----
-  1  ≤ |S|  ≤ 1,000
-  S will only contain digits 0-9 and uppercase Latin letters. 

-----Example-----
Input1:
06454

Input2:
C0D3C43F

Output1:
6454

Output2:
3943

-----Explanation-----

In the first example, there is no choice as to what the number can be. It has to be 6,454.

In the second example, there are a total of 41 possible strings (one for the original, and 10 for changing each letter). You can verify that the maximum number as a substring is got by making the string "C0D3943F".

Difficulty: interview

Starter code:

Solutions:
string=input()
max_no=0
for i in range(len(string)):
 var_occur=0
 check_no=str()
 j=i
 while(j<len(string) and var_occur<2 ):
  if(string[j].isalpha()):
   if(var_occur==0):
    check_no+='9'
    var_occur+=1
   else:
    var_occur+=1
  else:
   check_no+=string[j]
  j+=1
 #print(check_no)
 max_no=max(max_no,int(check_no))
print(max_no)

def main():
 res = 0
 ind = 0
 curr = []
 letterflag = False

 chars = list(input())

 for c in chars:
  if c.isalpha():
   if letterflag:
    val = int(''.join(curr))
    res = max(res, val)
    curr = curr[ind:]
   else:
    letterflag = True

   curr.append("9")
   ind = len(curr)

  else:
   curr.append(c)

 # Last call
 val = int(''.join(curr))
 res = max(res, val)
 print(res)

main()