There are two integers (X and N). You have to make a number in such a way that it contains the first digit and last digit occurring in X1 , X2 , X3, .... XN.
let's take X=12 and N=5.
let l is last digit and f is first digit.
121 = 12 the first digit of 12 is 1(f1) and last digit is 2 (l1).
122 = 144 the first digit of 144 is 1 (f2) and last digit is 4 (l2).
123 = 1728 the first digit of 1728 is 1 (f3) and last digit is 8 (l3).
124 = 20736 the first digit of 20736 is 2 (f4) and last digit is 6 (l4).
125 = 248832 the first digit of 248832 is 2 (f5) and last digit is 2 (l5).
We made a number in the format f1 l1 f2 l2 f3 l3 f4 l4 f5 l5 .
so number becomes 1214182622.
The line contains number of test cases T. t testcases follow. Each testcase contains single line of input containing X and N .
For each testcase in a new line, print output as directed.
1 <= T <= 150
10 <= X <= 84
1 <= N <= 5
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.