import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Solution { public static void main(String[] args) throws Exception { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); for (int i = 0; i < T; i++) { String[] values = br.readLine().trim().split("\\s+"); long N = Long.parseLong(values[0]); long K = Long.parseLong(values[1]); System.out.println(slove(N, K)); } } private static int slove(long n, long k) { if (k > (int) Math.ceil(n / 2.0)) { return 0; } return combineCount(n - k + 1, k).mod(new BigInteger(100003 + "")).intValue(); } private static BigInteger combineCount (long N, long K) { BigInteger ret = BigInteger.ONE; for (long k = 0; k < K; k++) { ret = ret.multiply(BigInteger.valueOf(N-k)) .divide(BigInteger.valueOf(k+1)); } return ret; } }