import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int t = sc.nextInt(); while( t > 0 ) { solve(); t--; } pw.flush(); } static void solve() { long A = sc.nextInt(); long B = sc.nextInt(); long C = sc.nextInt(); A %= B; A *= modpow(10,C-1,B); A %= B; A *= 10; pw.println(A/B); } static long modpow( long x, long n, long mod ) { if( n == 0 ) { return 1; } long k = 1; while( n > 1 ) { if( n%2 == 1 ) k *= x; x *= x; n /= 2; x %= mod; k %= mod; } return (k*x)%mod; } }