#include<bits/stdc++.h>
#define ll          long long
#define inf         999999999999999
#define ull         unsigned long long
#define F           first
#define S           second
#define eb          emplace_back
#define mpp         make_pair
#define P(x)        cout<<__LINE__ <<": "<<#x<<' '<<(x)<<'\n'
#define dbg         cout<<__LINE__ <<": 0manush\n"
#define read(x)     freopen("input.txt","r",stdin);
#define write(x)    freopen("aoutput.txt","w",stdout)
#define fast        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi          2*acos(0.0)
#define pi2         M_PI
#define lcm(a,b)    ((a)*((b)/__gcd(a,b)))
#define mem(a,b)    memset(a,b,sizeof(a))
#define ee          exp(1)
#define mx          100007
#define mod         10000000000
#define enddl       cout<<endl;
using namespace std;

int main(){//read(x);
//fast;
ll a,b,c,d,r,e,g,h,i,j,k,l,n,t,z=0,p,q;
cin>>a>>b;
if(a==b)cout<<b<<endl;
else{
    if(a==0 && b==1)cout<<2<<endl;
    if(a==0 && b==2)cout<<1<<endl;

    if(a==1 && b==2)cout<<0<<endl;
    if(a==1 && b==0)cout<<2<<endl;

    if(a==2 && b==0)cout<<1<<endl;
    if(a==2 && b==1)cout<<0<<endl;
}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iomanip>
using ll = long long;
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    if(x == y) cout << x;
    else cout << 3-x-y;
}
