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