#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1005,mod=10000;
int n,k,f[N][N],sum[N][N];
signed main(){
freopen("permut.in","r",stdin);
freopen("permut.out","w",stdout);
scanf("%lld%lld",&n,&k); f[1][0]=1; //sum[1][0]=1;
for(int i = 1;i<=n;i++){
for(int j = 0;j<=k;j++){
//for(int k = j-i+1;k<=j;k++)
// f[i][j]+=f[i-1][k];
f[i][j]=((f[i][j]+sum[i-1][j]%mod-sum[i-1][j-i])+mod)%mod;
sum[i][j]=(sum[i][j-1]+f[i][j])%mod;
}
}
printf("%lld",f[n][k]);
return 0;
}