T = int(input()) for _ in range(T): A, B, C = map(int, input().split()) print(A * pow(10, C, B) // B % 10)