T = int(input()) for i in range(T): A,B,C = map(int,input().split()) print((A*pow(10,C,10*B)%(10*B)-A*pow(10,C,B)%B)//B)