#include<bits/stdc++.h>
#define w(x)            int x; cin>>x; for(int tc=1;tc<=x;tc++)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define trace1(x,y)		cerr<<#x<<": "<<x<<" "<<endl;cerr<<#y<<": "<<y<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb push_back
#define endl "\n"
#define mod 1000000007
#define inp(x) cin>>x;
#define f first
#define s second
#define inf 1e18

using namespace std;
void solve(int tc) {
	int a, b;
	cin >> a >> b;
	if (a == b) {
		cout << a << endl;
	} else {
		if (a == 0 and b == 1) {
			cout << 2 << endl;
		} else if (a == 1 and b == 2) {
			cout << 0 << endl;
		} else if (a == 0 and b == 2) {
			cout << 1 << endl;
		} else {

			swap(a, b);
			if (a == 0 and b == 1) {
				cout << 2 << endl;
			} else if (a == 1 and b == 2) {
				cout << 0 << endl;
			} else if (a == 0 and b == 2) {
				cout << 1 << endl;
			}
		}

	}

}

int32_t main() {
	FIO
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	// w(x) {
	solve(1);
	// }
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int A, B;
  cin >> A >> B;
  if(A==B) cout << A << endl;
  else cout << 3-A-B << endl; 
}