Having reached the end of my poor sinner’s life, waiting for my ailing and heavy body to free my soul to face me against the Lord, old and misty memories that I still preserve come to my mind, even though, at the same time, I’m not even able, as a spell of the Antichrist, to remember what I had for breakfast after Matins. Being just a callow novice, ignorant of the saint and iron dis- cipline in the monastery, I had a confrontation with the abbot, whose name it is only right and pious now to omit, due to what my young discernment considered an affront with the Brother Li- brarian. He ordered Adso, another novice who would eventually become a wise Franciscan, and me to number the 200 pages of a new edition of the Aristotle’s Poetics that several brothers had been transcribing some months ago. The librarian, God rest his soul, assigned Adso the numbering of the very first 100 pages of the manuscript, 1 til 100, while I was commanded to number the last 100, from 101 to 200. I had heard disturbing rumours about a curse that killed anyone that became interested in that precise book, and realised that I would be forced to transcribe many more digits, but not pages, than my cell-mate, what led me to my confrontation with the abbot. He, who considered a mere lust for knowledge that I had even considered such a thing in the first place, punished me by praying at Lauds, Terce and Vespers for a complete year the Psalm 30 to beg for protection against injustices. Even so, he must have seen something in my shiny little young eyes, because he conceded to give me a bull from his penalty if I told him what was the last page that Adso should be numbering, and where should I start numbering so that the distribution was fair to both of us. This way, if Adso numbered an extra page, he would be transcribing more digits than me. I reaped what I sowed because my astuteness vanished and not even today has the Lord granted me the grace to know the answer. Input The input consists of an undetermined number of pairs of integers, (p1,p2). The first one indicates the starting page that must be numbered and the second one shows the last page. It can be safely assumed that 1 ≤ p1 < p2 ≤ 1,000,000. The input ends with a pair of zeros. Output For each testcase, the program will write the number of the last page that should be numbered by Adso, the first novice, so that both of them write the same number of digits. If this turns out to be impossible, Adso will have to number as many pages as possible without exceeding the number of digits transcribed by the second novice. Sample Input 1 200 99 100 99 101 97 103 00
2/2 Sample Output 118 99 99 100