#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
const long long  MOD = 1000000007;
typedef long long ll;
using namespace std;

ll gcd(ll m,ll n){
    if(n==0) return m;
    return gcd(n,m%n);
}

int main(){
    int x, y;
    cin >> x >> y;
    if(x == 0 && y == 0) cout << 0 << endl;
    if(x == 1 && y == 1) cout << 1 << endl;
    if(x == 2 && y == 2) cout << 2 << endl;
    if(x == 0 && y == 1) cout << 2 << endl;
    if(x == 1 && y == 0) cout << 2 << endl;
    if(x == 1 && y == 2) cout << 0 << endl;
    if(x == 2 && y == 1) cout << 0 << endl;
    if(x == 0 && y == 2) cout << 1 << endl;
    if(x == 2 && y == 0) cout << 1 << endl;
    return 0;
} 
/*

GNU G++ compiler
Author-Ajay Raj Singh

while(alive)
{
    eat();
    sleep();
    code();
}

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//#include<boost/multiprecision/cpp.hpp>
//#include<boots/algorithms/string.hpp>
#define ll long long int
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define vs vector<string>
#define vvi vector<vector<ll>>
#define pb push_back
#define flush fflush(stdout)
#define freq(x,val) count(x.begin(),x.end(),val)
#define permute(v) next_permutation(v.begin(),v.end())
#define all(x) x.begin(),x.end()
#define add(v) accumulate(v.begin(),v.end(),0)
#define mci map<char,ll>
#define mii map<ll,ll>
#define endl "\n"
#define db long double
const ll mod=1e9+7;
using namespace __gnu_pbds;
using namespace std;
ll pow(ll x,ll y)
{
    ll res=1;
    x=x%mod;
    while(y>0)
    {
        if(y&1)
        res=(res*x)%mod;
        y=y>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll modinv(ll a)
{
    return pow(a,mod-2);
}
void printval(ll x,ll y)
{
    cout<<"Case #"<<x<<": "<<y<<endl;
    return;
}
void solution()
{
    ll x,y;
    cin>>x>>y;
    if(x==y)
    cout<<x<<endl;
    else
    cout<<(3-(x+y))<<endl;
}
int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solution();
    }
    return 0;
}