Getting WA in SWPDGT

All custom test cases are passing.
Can anyone help me finding error in this Code ?

Here is the link to my solution
[CodeChef: Practical coding for everyone]

Your code fails for single digit numbers.
Input:
1
5 2
Your Output:
52
Actual Output:
7

@dragonado still getting WA
here is the updated solution
https://www.codechef.com/viewsolution/30856978

Now it fails for a combination of single and double digit numbers.
Input:
1
1 12
Your Output:
31
Actual Output:
13

Make sure you try all these testcases yourself and look at the AC solutions and try understanding them.

i have checked my code for all the test cases but still getting WA.can u help me out.
https://www.codechef.com/viewsolution/30858037