// Counting Template
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
const long long FACSIZE=1048576;
long long power(long long a,long long b){
long long x=1,y=a;
while(b>0){
if(b&1ll){
x=(x*y)%mod;
}
y=(y*y)%mod;
b>>=1;
}
return x%mod;
}
long long modular_inverse(long long n){
return power(n,mod-2);
}
long long factorial[FACSIZE];
long long invfact[FACSIZE];
void cfact(){
long long i;
factorial[0]=1;
factorial[1]=1;
for(i=2;i<FACSIZE;i++){
factorial[i]=factorial[i-1]*i;
factorial[i]%=mod;
}
invfact[FACSIZE-1]=modular_inverse(factorial[FACSIZE-1]);
for(i=FACSIZE-2;i>=0;i--){
invfact[i]=invfact[i+1]*(i+1);
invfact[i]%=mod;
}
}
long long calcnCr(long long n,long long k){
if(k<0 || n<k){return 0;}
return (factorial[n]*((invfact[k]*invfact[n-k])%mod))%mod;
}
using ll=long long;
long long solve(){
// write your code here, and return the answer
long long d,n;
cin >> d >> n;
if(d>n){return 0;}
n-=d;
ll res=0;
for(ll t2=0;t2<=n;t2++){
ll t3=n-2*t2;
if(t3<0 || t3%3!=0){continue;}
t3/=3;
ll del=calcnCr(d,t2);
del*=calcnCr(d,t3);
res+=del; res%=mod;
}
return res;
}
int main(){
cfact();
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
// cin >> t;
while(t>0){
t--;
cout << solve()%mod << "\n";
}
return 0;
}