#include <bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	scanf("%d%d",&a,&b);
	printf("%d",a==b?a:3-a-b);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);(i)++)
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;


int main(){
    int A,B,C;
    cin >> A >> B;
    if(A==B) cout << A << endl;
    else{
        if(A+B==1) cout << 2 << endl;
        if(A+B==2) cout << 1 << endl;
        if(A+B==3) cout << 0 << endl;
    }
}