import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count = in.nextInt(); for(int i=0;i<count;i++){ long n = in.nextLong(); long k = in.nextLong(); n = n-k+1; /*BigInteger bign = BigInteger.valueOf(n); for(int j=1;j<k;j++){ bign = bign.multiply(BigInteger.valueOf(n-j)); //n = n*(n-j) % 1000000000; } BigInteger bigk = BigInteger.valueOf(k); for(int j=1;j<k;j++){ bigk = bigk.multiply(BigInteger.valueOf(k-j)); //k = k*(k-j) % 1000000000; } BigInteger result = bign.divide(bigk); System.out.println(result.mod(BigInteger.valueOf(100003)));*/ //System.out.println(n/k % 100003); if(n < k){ System.out.println(0); }else if(n==k){ System.out.println(1); }else{ System.out.println(combination(n, k, 100003)); } } } static long factorial(long n, int mod) { long m = 1; for(int i = 2; i <= n; i++) m = ((m % mod) * (i % mod)) % mod; return m; } static long combination(long n, long r, int mod) { long numerator = factorial(n, mod); long denominator = factorial(r, mod) * factorial(n - r, mod); long inversed = new BigInteger("" + denominator) .modInverse(new BigInteger("" + mod)).longValue(); return (numerator * inversed) % mod; } }