Akaash was given an assignment by his teacher. He is given a integer N and another integer K. It is told that N is the integeral part of Kth root of some integer.He needs to find out how many such integers are possible (Refer sample for explaination).Since he is weak at mathematics, help him do his assignment.

Input :
First line of input contains a single integer T denoting the number of test cases.The only line of each test case contains 2 space-separated integers N and K.

Output :
For each test case, print the required answer.

Constraints :
1 <= T <= 500
1 <= N <= 100
2 <= K <= 8

Example :
Input :
3
3 2
2 3
2 2 Output :
7
19
5

Explaination :
Case 1 :
3 can be the integeral part of square root of following numbers:
9 10 11 12 13 14 15
Case 2 :
2 can be the inetgeral part of cube root of following numbers:
8 9 10 11 ... 26
Case 3 :
2 can be integeral part of square root of following numbers:
4 5 6 7 8