for _ in range(int(input())): a, b, c = map(int,input().split()) ans = ((a * pow(10, c, 10 * b)) // b) % 10 print(ans)