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