F。模板题
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
using namespace std;
const int INF=0x3f3f3f3f;
typedef long long LL;
const int mod=1e6+3;
const int maxn=1e6+100;
LL fac[maxn],inv[maxn];
LL Pow(LL a,LL b)
{
LL ans=1;
while(b)
{
if(b&1)
ans=(ans*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return ans;
}
int main()
{
int cas=0;
int n,a,b;
fac[0]=inv[0]=1;
for(int i=1;i<=1000000;i++)
{
fac[i]=(fac[i-1]*i)%mod; //对阶乘打表
inv[i]=Pow(fac[i],mod-2);
}
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&a,&b);
LL ans=fac[a]*inv[b]%mod*inv[a-b]%mod;
printf("Case %d: %lld\n",++cas,ans);
}
return 0;
}