#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,y,z;
    cin>>x>>y;
    if(x==y) z=y;else{
        if((x==0&&y==1)||(x==1&&y==0))z=2;
        if((x==0&&y==2)||(x==2&&y==0))z=1;
        if((x==2&&y==1)||(x==1&&y==2))z=0;        
    }
    cout<<z<<endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int>pi;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int x , y ;
    cin >> x >> y ;
    if( x == y ) cout << x << "\n";
    else cout << 3 - x - y << '\n' ;
    return 0;
}

