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