BETA

Submissions : 2552 Accuracy :

37.85

Print the Kth Digit
     

Given two numbers a and b, find kth digit from right of a^b.

Input:

The first line of the input contains T denoting the number of test cases.Each of the next T lines contains three space separated positive integers denoting the value of a , b and k respectively.


Output:

For each test case, output the kth digit from right of a^b in new line.


Constraints:

1<=T<=100
1<=a , b <=15
1<=k<=|totaldigits in a^b|


Example:

Input:
2
3 3 1
5 2 2

Output:
7
2

**For More Examples Use Expected Output**


Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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