T=int(input()) for i in range(T): a,b,c=map(int,input().split()) c=pow(10,c,10*b) print(a*c//b%10)