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