#include <iostream>
using namespace std;
int main() {
    int x,y;
    cin >> x >> y;
    if(x==y) {
        cout << x << endl;
        return 0;
    }
    else{
        cout << 3-x-y << endl;
        return 0;
    }
}
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define endl '\n'
#define pb push_back
#define conts continue
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(), a.rend()
#define no cout << "NO" << endl
#define yes cout << "YES" << endl
#define ff first
#define ss second
#define ceil2(x,y) (x+y-1) / y

#ifndef ONLINE_JUDGE
#define debug(x) cout << #x <<" = "; print(x); cout << endl;
#else
#define debug(x)
#endif

bool iseven(ll n) {if ((n & 1) == 0) return true; return false;}

void print(ll t) {cout << t;}
void print(int t) {cout << t;}
void print(string t) {cout << t;}
void print(char t) {cout << t;}
void print(double t) {cout << t;}
void print(ld t) {cout << t;}

template <class T, class V> void print(pair <T, V> p);
template <class T> void print(vector <T> v);
template <class T> void print(set <T> v);
template <class T, class V> void print(map <T, V> v);
template <class T> void print(multiset <T> v);
template <class T, class V> void print(pair <T, V> p) {cout << "{"; print(p.ff); cout << ","; print(p.ss); cout << "}";}
template <class T> void print(vector <T> v) {cout << "[ "; for (T i : v) {print(i); cout << " ";} cout << "]";}
template <class T> void print(set <T> v) {cout << "[ "; for (T i : v) {print(i); cout << " ";} cout << "]";}
template <class T> void print(multiset <T> v) {cout << "[ "; for (T i : v) {print(i); cout << " ";} cout << "]";}
template <class T, class V> void print(map <T, V> v) {cout << "[ "; for (auto i : v) {print(i); cout << " ";} cout << "]";}

void solve()
{   
    ll a,b; cin >> a >> b;
    if(a == b){
        cout << a << endl;
    }
    else{
        if(a > b){
            swap(a,b);
        }

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

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("D:/Competitive Programming/input.txt", "r", stdin);
    freopen("D:/Competitive Programming/output.txt", "w", stdout);
#endif
    fastio;
    solve();
    return 0;
}