using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; class Solution { const int MOD = 100003; static void Main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ //build up binom coefficients var T = int.Parse(Console.ReadLine()); for(var i = 0; i < T; i++){ var NandK = Console.ReadLine().Split(' ').Select(Int64.Parse).ToArray(); var N = NandK[0]; var K = NandK[1]; var n = N - K + 1; Console.WriteLine((NChoosK(n, K))% MOD); } } static BigInteger NChoosK(BigInteger n, BigInteger k){ if(n < k) return 0; if(k > n - k) k = n -k; BigInteger result = 1; for(int i = 1; i <=k;i++){ result *= n - k + i; result /= i; } return result; } }