def main(): T = int(input()) for i in range(T): a, b, c = map(int, input().split()) m = a * pow(10, c-1, b) % b print(m*10//b) if __name__ == '__main__': main()