#yuki1815 def f(a,b,c): a*=pow(10,c-1,b) a%=b return (a*10)//b t=int(input()) for i in range(t): a,b,c=map(int,input().split()) print(f(a,b,c))