Bosky often helps his younger brother Nitin with his home work and also clears his doubts.

Today, Nitin learned about proper fractions. He went a step forward and tried to represent the same proper fraction in its decimal form, but runs into problems. He now seeks help from his brother Bosky.

Nitin is a very sincere learner, thus he wants his brother to help him but doesn't want him to completely solve the problem. He goes to his brother Bosky and asks him to help him wherever he gets stuck while representing the proper fraction in decimal expansion by telling the next digit in the decimal expansion.

Though Bosky is a bit busy today with his school project, he doesn't want to disappoint his brother. He is familiar with your brilliant programming skills and asks you to create a program to help his brother, which can output R th digit in the decimal expansion for a given proper fraction \frac{N}{D}.

Input:

Input will contain a number T denoting the number of test cases. 

Then T test cases follow, each one consisting 3 integers N D R
where N and D are numerator and denominator respectively.

Output

For each test case, output a single integer representing R th digit from the left in the decimal expansion. 

NOTE: The number is a proper fraction, hence the counting will always start after the decimal place. For eg. fraction \frac{1}{2} can be written as 0.5 so its first digit is 5 and all the digits after 5 are 0.

Constraints

1  ≤  T  ≤ 100

1  ≤ N ≤  D ≤ 1000000

1  ≤ R ≤ 1000000

SAMPLE INPUT
4
1 2 1
1 2 2
1 2 20
1234 12345 123

SAMPLE OUTPUT
5
0
0
7

Explanation

Case 1 : 1\; 2\; 1
\frac{1}{2} = 0.5 and 1st digit is 5.

Case 2 and 3: 
\frac{1}{2} = 0.50000000000000000000 
All digits after 5 are 0, hence the output is 0 and 0.

Case 4: Same logic!

Difficulty: EASY

Solutions:
def fracnum(N,D,R):
	N = N % D
	
	v, d = abs(N)*10, abs(D)
	while R:
		(v, r, R) = ((v%d)*10, v//d, R-1)

	return r
name = int(input())
count = 0
while count < name :
	count += 1
	strings = input()
	words = strings.split()
	N = int(words[0])
	D = int(words[1])
	R = int(words[2])
	print(fracnum(N,D,R))