Carol is buying water for her Cactus. However her Cactus has a problem - he simply does not understand how much water is too much water. However, it is essential that she keep water away from her Cactus, for the Cactus will go seek out more water and then die of water overdose.
Thus, Carol needs a way to calculate the perfect amount of water required to quench her Cactus' thirst.
She gives you ~N~, the minimum amount of water Cactus must drink to stay alive, and ~M~, the amount of water that will cause water overdose and death. Carol discovered that she can prevent Cactus from seeking out more water by presenting the water at a cute number, thus distracting Cactus.
A cute number is a number that is palindromic. e.g. ~11\,111~ is cute, and ~1\,001~ is cute. Find the palindromic number that is farthest from ~N~ and ~M~ as possible. This would be the maximum of the smaller of the two absolute differences. If there are multiple cute numbers equally far apart, then use the highest, as more water makes Cactus happy.
~1 \le N, M \le 10^8~
The first line will contain ~N~ and ~M~, the minimum and maximum water value.
The amount of water that Carol should purchase for her Cactus. The input data are set such that Carol will be able to purchase water for her Cactus.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2