import sys input = sys.stdin.readline t = int(input()) for _ in range(t): a, b, c = map(int, input().split()) res = a * pow(10, c, 10 * b) print((res // b) % 10)