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