Seven Up


This project involves finding the right-most digit 7 in a given number. The numbers are specified as a base B and exponent E, where N = BE (i.e. B to the power E). Each of B and E will be positive integers less than 109 (i.e. 9 digits or fewer)

Your program should find the position of the right-most digit equal to 7 in N, where the end right position is 1. That position should be printed out. If N has no digit 7, then print "No seven" as shown below.

Input will consist of a positive integer K which indicates the number of test cases followed by K lines each containing a pair of numbers. The input will be chosen so that BE is less than 1016 (i.e. 16 digits or fewer).

Sample Input:

6
5678 1
5678 4
2 48
2 49
777 3
9993 4
(In order to follow the output, it will be useful to know that the above 6 pairs evaluate to:
5678
1039397224419856
281474976710656
562949953421312
469097433
9972029386282401
).

Sample Output:

2
10
6
No seven
4
14