 Make the hit in power game !
Submissions: 557   Accuracy: 42.18%   Difficulty: Basic   Marks: 1

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 X, X, 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 (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.

Input Format:
The line contains number of test cases T. t testcases follow. Each testcase contains single line of input containing  X and N .

Output format:
For each testcase in a new line, print output as directed.

Constraints:
1 <= T <= 150
10 <= X <= 84
1 <= N <= 5

Examples:
Input:
2
10 5
19 4

Output:
1010101010
19316911

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Nagaria

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.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.