{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003e\u003cb\u003eDash’s Palindromic Milestones\u003c/b\u003e\u003cbr /\u003e\n\u003cbr /\u003e\u003cbr /\u003eOne of Mr. Incredible’s greatest opponents , Cixelsyd, was dyslexic. When reading a word or a number (especially an isolated one), he would get confused and would sometimes read from right to left instead of left to right. When he was building the Grand National highway to unite his vast empire, he decided to number the milestone in such a manner that he would never get confused while travelling. His ingenious solutions was to leave all milestone blank , except those carrying the number that read same both forwards and backwards. So, the first 10 milestones would be 0,1,2,……..9 ( where 0 is the starting point) followed by 101,111,121, etc. Milestone for the distances that are not of this form are left blank.\u003cbr /\u003e\n\t\u003cbr /\u003e\u003cbr /\u003eDash is running along one such highway starting from the capital, and to keep himself alert, decides to play the following game. When dash is at distance k miles from the capital, he picks up the number n and tries to guess what will be the number on the ‘n’th non-blank milestone from this point (not including the current milestone , if there is any). Design a program to do this.\u003c/p\u003e\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003eThe input will contain several test cases.\u003cbr /\u003e The first line contains a positive integer N having the number of number of test cases.\u003cbr /\u003e For every test case, there are 2 lines. \u003cbr /\u003eThe first line contains the positive integer k ( the miles covered so far) and the second line contains n ( which milestones value is to be calculated).\u003cbr /\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\u003cb\u003eInput Constraints: n and k must be between 1 and 10000\u003c/b\u003e\u003c/p\u003e\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eYour output should be one line per test case , giving the reading on the n-th non blank milestones after the k-th mile.\u003c/p\u003e\n\u003ch3\u003eExample\u003c/h3\u003e\n\u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n2\n13\n2\n99\n3\n\n\u003cb\u003eOutput:\u003c/b\u003e\n33 \n121\n\u003c/pre\u003e\u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n1\n100000\n100000\n\n\u003cb\u003eOutput:\u003c/b\u003e\n910999019\n\u003c/pre\u003e"}}]}