import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static BigInteger factorial(int x) { BigInteger result = BigInteger.ONE; BigInteger mod = new BigInteger("100003"); BigInteger n = BigInteger.valueOf(x); while (!n.equals(BigInteger.ZERO)) { result = result.multiply(n); n = n.subtract(BigInteger.ONE); } return result; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner input = new Scanner(System.in); int testcases = input.nextInt(); while(testcases > -2){ int houses = input.nextInt(); int n = input.nextInt(); int k = houses-n; if(k >= n) { BigInteger fK2 = factorial(k+1); BigInteger fN1 = factorial(n); BigInteger fN2 = factorial((k+1)-n); BigInteger result1 = fK2.divide(fN2); BigInteger result2 = result1.divide(fN1); BigInteger mod = new BigInteger("100003"); System.out.println(result2.mod(mod)); } else { System.out.println("0"); } testcases--; } } }