#include<bits/stdc++.h>
using namespace std;
#define     M                     1000000007
#define     ll                    long long
#define     FIO                   ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     ifor(st,lim)          for(int i=st;i<lim;i++)
#define     jfor(stt,llim)        for(int j=stt;j<llim;j++)
#define     pb                    push_back

void solve() {
	// cout<<"X";
	int x,y; cin>>x>>y;

	if(x == y) {
		cout<<x;
	}else {
		// 0 1 2
		// 0 1 2
		cout<< 3 - (x + y);
	}
}
void file_i_o() {
	#ifndef ONLINE_JUDGE  
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}
int main()
{
	file_i_o();
	FIO;
	int t=1;
	while(t--) {
		solve();
	}
}	
#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define fr(i,n) for(int i=0;i<n;i++)
#define pct(i,n) cout<<"Case "<<i<<": "<<n<<endl;
#define fast()    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define e   "\n"

int main()
{
    int x,y; cin>>x>>y;
    if(x==y){
        cout<<x<<e;
    }

    else if(x==0&&y==1){
        cout<<2<<e;
    }

    else if(x==1&&y==0){

        cout<<2<<e;
    }
    else if(x==1&&y==2){
        cout<<0<<e;
    }
    else if(x==2&&y==1){
        cout<<0<<e;

    }

    else if(x==2&&y==0){

        cout<<1<<e;
    }
    else if(x==0&&y==2){

        cout<<1<<e;
    }


    return 0;
}

