#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
/*
# Enter your code here. Read input from STDIN. Print output to STDOUT
  def choose(n,m)
    return (fact(n) / (fact(m) * fact(n - m)))
  end

$facts = {}
  def fact(m)
      $facts[m] = (2..m).inject(1) { |f, n| f * n } unless $facts[m]
      $facts[m]
  end


STDIN.read.split("\n").each do |a|
    nums = a.split(" ").map(&:to_i)
    next if nums.size == 1
    puts choose(((nums[0] + 2) - nums[1]), nums[1] - 1)    
end
*/

int mul_inv(int a, int b)
{
	int b0 = b, t, q;
	int x0 = 0, x1 = 1;
	if (b == 1) return 1;
	while (a > 1) {
		q = a / b;
		t = b, b = a % b, a = t;
		t = x0, x0 = x1 - q * x0, x1 = t;
	}
	if (x1 < 0) x1 += b0;
	return x1;
}

int choose(int n, int m) {
    long top = (long) 1;
    long bottom = (long) 1;
    for(long i = (n - m + 1); i <= n; i++) {
        top *= i;
        top %= 100003;
    }
    for(long i = 2; i <= m; i++) {
        top *= mul_inv(i, 100003);
        top %= 100003;
    }
    return (int)top;
}

int main() {
    int count;
    scanf("%d", &count);
    for(int i = 0; i < count; i++) {
        int n;
        int m;
        scanf("%d %d", &n, &m);
        printf("%d\n", choose(((n + 2) - m - 1), m));
    }
    return 0;
}