#include using namespace std; #define int long long constexpr int mod = 1000000007; inline int qpow(int x, int y, int z){int ret = 1; for (; y; y /= 2, x = x * x % z) if (y & 1) ret = ret * x % z; return ret;} signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while (T --) { int A, B, C; cin >> A >> B >> C; cout << (qpow(10, C - 1, B) * A % B * 10) / B << "\n"; } return 0; }