Vasya has been collecting transport tickets for quite a while now. His collection contains several thousands of tram, trolleybus and bus tickets. Vasya is already fed up with the traditional definition of what a lucky ticket is. Thus, he's looking for new perspectives on that. Besides, Vasya cannot understand why all tickets are only divided into lucky and unlucky ones. He thinks that all tickets are lucky but in different degrees. Having given the matter some thought, Vasya worked out the definition of a ticket's degree of luckiness. Let a ticket consist of 2*n* digits. Let's regard each digit as written as is shown on the picture:

You have seen such digits on electronic clocks: seven segments are used to show digits. Each segment can either be colored or not. The colored segments form a digit. Vasya regards the digits as written in this very way and takes the right half of the ticket and puts it one the left one, so that the first digit coincides with the *n* + 1-th one, the second digit coincides with the *n* + 2-th one, ..., the *n*-th digit coincides with the 2*n*-th one. For each pair of digits, put one on another, he counts the number of segments colored in both digits and summarizes the resulting numbers. The resulting value is called the degree of luckiness of a ticket. For example, the degree of luckiness of ticket 03 equals four and the degree of luckiness of ticket 2345 equals six.

You are given the number of a ticket containing 2*n* digits. Your task is to find among the tickets whose number exceeds the number of this ticket but also consists of 2*n* digits such ticket, whose degree of luckiness exceeds the degrees of luckiness of the given ticket. Moreover, if there are several such tickets, you should only choose the one with the smallest number.
The first line contains the number of the ticket that consists of *k* characters (*k* = 2*n*, 1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>).
13
20
2345
2348
88
-1
682444
682445
685116
685120
576079
576086
569631
569632
662302
662362
453066
453068
659821
659822
26592659
26602660
47699969
47804080
09980988
28882888
69886888
80888088
9588995888
9608886088
39930089893999008989
39930098883883008888
84163081988476808998
84163082000406308200
88898888988889888898
88988888888888888888
01273988890029888889
01274888880020488888
18858998881886898888
18859888880885888888
8259988583
8259988588
5898888944
5898888945
855889831888
855889832088
439968658988
439968688868
335598338288
335598338388
43223543566815212912981204669368711837288602368426888989998989988898989999998988988988999998999899984322884358881924880288488486998884783928868286842888888998888898888898889898888898898888888898889888
43223543566815212912981204669368711837288602368426888989998989988898989999998988988988999998999908884322354356680520280288020466836800083028860236842688888888888888888888888888888888888888888888880888
99393666387527964893713203630389899998898999889989898999898899999899899899998889899998898989989889998888368888898788888990888868038988989889889888898989888889889998989989889899888888989888898998988899
99393666387527964893713203630389899998898999889989898999898899999899899899998889899998898989989890888838366638052086488300320363038888888888888888888888888888888888888888888888888888888888888888888088
40724501726491585262016953677772948189547459145312538682757304290442786808955140603033718167250989898098898078698368686201885869883288848858845889691868888805988428844298880895618068983393806889898888
40724501726491585262016953677772948189547459145312538682757304290442786808955140603033718167250998884002450002648058526200685360000284808854045804530253868205030428044208680885504060303300806025088888
79088264099789040101338987288228743957988889999888988998999888988999988999899889889999999898888899889988886808878908600889888328888899889798888998981888888899888888878998898888888958898899988888889988
79088264099789040101338987288228743957988889999888988998999888988999988999899889889999999898888899889988886808878908600889888328888899889798888998981888888899888888878998898888888968888888888888888888
51974056597584768542734492125108488334626378590999898888998889899888898998889989988889898988999988899790085898898976884233448882618888038888883899099888888888888989888888888888988888888889888819998888
51974056597584768542734492125108488334626378590999898888998889899888898998889989988889898988999988899790085898898976884233448882618888038888883899099888888888888989888888888888988888888889888820888888
496198999898
496200006200
09989988
20882088
748989888889
749888048888
6984899899
6984968848
68623695792730582626313022231731418370802097728016898999999888889889989888989999898988988898888988888868389688838098868896902888793384830880209692808589899898888888888988888898888888898898888888898888
68623695792730582626313022231731418370802097728016898999999888889889989888989999898988988898888988888868389688838098868896902888793384830880209692808688888888888888888888888888888888888888888888888888
34740506804988021948888998989898988889889889898888899989999999888988998998998889898989899998899998888439088688898808894888899898888898880988888989888889898989999988898898889899888989898989899888888888
34740506804988021948888998989898988889889889898888899989999999888988998998998889898989899998899998888439088688898808894888899898888898888888888888888888888888888888888888888888888888888888888888888888
22938645962769613028898841128696546129021084561286040502773858728727299998988899899898989998888888888889889986296978908889880418888689802802008858828808868208988898888988999888889889989898898888888888
22938645962769613028898841128696546129021084561286040502773858728727299998988899899898989998888888888889889986296978908889884002868654602802008456028604050200385802802028888888888888888888888888888888
34746525584443243456003041207650137412317331793360297058977077354535244802188888988888998998888889893498898958888388396600804028869848940893993789898089309887308898469904880874888898808889898888888888
34746525584443243456003041207650137412317331793360297058977077354535244802188888988888998998888889893498898958888388396600804028869848940893993789898089309887308898469904880874888898888888888888888888
85134786461893350509517211574918339368780716712903244472148878199438599584095845405384064998889998998978978848989896088984387453988889938838099684288884488234888898993888858909888643588888493888998888
85134786461893350509517211574918339368780716712903244472148878199438599584095845405384064998889998998978978848989896088984387453988889938838099684288884488234888898993888858909888643588888498888888888
0380023162775902996798876281379973370849
0380023162775902996798876281379973370850
3317497200125434836799763396859317396410
3317497200125434836799763396859317396420
5212759368584085865703568602327752094982
5212759368584085865703568602327752094983
547226955080909274578712855056537756831350123450633621352615
547226955080909274578712855056537756831350123450633621352616
090134011009710349472352007887283047446420798236414107901761
090134011009710349472352007887283047446420798236414107901763
print("_RANDOM_GUESS_1691501011.1933095")# 1691501011.1933281