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