Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, .
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, .
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, .
Clearly there cannot be any bouncy numbers below one-hundred, but just over half of the numbers below one-thousand () are bouncy. In fact, the least number for which the proportion of bouncy numbers first reaches is .
Surprisingly, bouncy numbers become more and more common and by the time we reach the proportion of bouncy numbers is equal to .
Find the least number for which the proportion of bouncy numbers is at least .
First line contains an integer denoting the number of test cases.
Each of the following lines contain two integers and .
For each of test cases print one line containing a single integer - the answer to a problem.