enigma
Source: hackerearth
Difficulty: EASY

Unfortunately Crookshanks(Laurent's cat) has eaten the problem statement. Are you good enough to solve it without the statement?

Input Format:

The first line contains T denoting the number of test cases. The next T lines describe test cases and contain two integers each: X and Y.

Output Format:

For each test case print one answer for that test case.

Constraints:

T ≤ 1000

1  ≤ X,Y  ≤ 10^9

SAMPLE INPUT
6
37 1
26 1
42 1
50 2
371592 2
136520 1532

SAMPLE OUTPUT
58
40
20
29
118
16