def my_pow(x, n, mod): if n == 0: return 1 elif n % 2 == 1: return (x * my_pow((x * x) % mod, n // 2, mod)) % mod else: return my_pow((x * x) % mod, n // 2, mod) T = int(input()) for _ in range(T): A, B, C = map(int, input().split()) rem = my_pow(10, C, 10 * B) rem = (A * rem) % (10 * B) print(rem // B)