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