import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static BigInteger binomial(final int N, final int K) { BigInteger ret = BigInteger.ONE; for (int k = 0; k < K; k++) { ret = ret.multiply(BigInteger.valueOf(N-k)) .divide(BigInteger.valueOf(k+1)); } return ret; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader stdin = new BufferedReader(isr); String input = new String(); Solution solution = new Solution(); try{ input = stdin.readLine(); int count = Integer.parseInt(input); for(int i = 0; i < count; i++) { input = stdin.readLine(); String[] inputs = input.split(" "); int n = Integer.parseInt(inputs[0]); int k = Integer.parseInt(inputs[1]); int freeHouses = (n-k-(k-1)); int partitions = k; if(freeHouses < 1 || partitions < 1) { System.out.println(0); } else { BigInteger perms = binomial(freeHouses + partitions, partitions); System.out.println(perms.mod(BigInteger.valueOf(100003))); } } isr.close(); stdin.close(); } catch (IOException e) { return; } } }