/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long

inline int inint(istream& in) {int x; in >> x; return x;}
inline ll inll(istream& in) {ll x; in >> x; return x;}
inline string instr(istream& in) {string x; in >> x; return x;}

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)


class ARockPaperScissors {
public:
void solve(std::istream& in, std::ostream& out) {

    int x = inint(in);
    int y = inint(in);

    if(x == y){
        out << x << endl;
        return;
    }

    if(x + y == 1){
        out << 2 << endl;
        return;
    }

    if(x + y == 2){
        out << 1 << endl;
        return;
    }

    if(x + y == 3){
        out << 0 << endl;
        return;
    }

}
};

int main() {
	ARockPaperScissors solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define deb(k) cerr << #k << ": " << k << "\n";
#define size(a) (int)a.size()
#define fastcin cin.tie(0)->sync_with_stdio(0);
#define st first
#define nd second
#define pb push_back
#define mk make_pair
#define int long long
typedef long double ldbl;
typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef vector<int> vint;
#define MAX 300100
#define MAXLG 20
const int inf = 0x3f3f3f3f;
const ll mod = 998244353;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int N = 300100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//knapstack
ll fat[MAX+100];
ll ifat[MAX+100];

ll power(ll x, ll y, ll p){
  ll res = 1;
  x = x % p;
  while (y > 0){
    if (y & 1) res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  }
  return res;
}

void init(){
	fat[0] = 1;
	for(ll i=1;i<=MAX;i++){
	  fat[i] = (fat[i-1]*i)%mod;
	}
	ifat[MAX] = power(fat[MAX], mod-2, mod);
	for(ll i=MAX-1;i>=0;i--) ifat[i] = (ifat[i+1]*(i+1))%mod;
}

ll choose(int x, int y){
	if(y < 0 || y > x || x < 0) return 0;
	return fat[x]*(ifat[y]*ifat[x-y]%mod)%mod;
}

int n, m;
int dp[5010][20];
int vis[5010][20];

int sol(int x, int y){
	if(y == 17){
		if(x) return 0;
		return 1;
	}
	if(vis[x][y]) return dp[x][y];
	vis[x][y] = 1;
	int &c = dp[x][y];
	for(int i=0;i<=n;i+=2){
		if( (1<<y)*i > x) break;
		c = (c + sol(x - (1<<y)*i, y+1)*choose(n, i)%mod)%mod;
	}
	return c;
}

void solve(){
	init();
	cin>>n>>m;
	cout<<sol(m, 0)<<"\n";


	// Have you read the problem again?
	// Maybe you understood the wrong problem
}

int32_t main(){
	fastcin;
	int t_ = 1;
	//cin>>t_;
	while(t_--)
		solve();
	return 0;
}
