#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  int x,y;
  cin >> x >> y;
  
  if(x==y){
    cout << x <<endl;
    return 0;
  }
  if(x+y==1) cout << 2 << endl;
  if(x+y==3) cout << 0 << endl;
  if(x+y==2) cout << 1 << endl;
  
}
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
using Graph = vector<vector<int> >;

#define INF 1e9
#define LLINF 1e18
#define PI 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;

template<class T> void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

ll gcd(ll a, ll b) {
    if(a % b == 0) {
        return b;
    }
    else {
        return(gcd(b, a % b));
    }
}

ll lcm(ll x,ll y){
    return ll(x / gcd(x, y)) * y;
}

//素因数分解vector<pair<素因数, 個数>>
vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while(n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

struct UnionFind {
    vector<int> par, siz;

    UnionFind(int n) : par(n, -1), siz(n, 1) {}

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        par[y] = x;
        siz[x] += siz[y];
        return true;
    }

    int size(int x) {
        return siz[root(x)];
    }
};

vector<int> BFS(const Graph &G, int s) {
    int n = (int)G.size();
    vector<int> p(n, -1);
    queue<int> que;
    p[0] = 0;
    que.push(0);

    while(!que.empty()) {
        int v = que.front();
        que.pop();

        for (int x : G[v]) {
            if (p[x] != -1) continue;
            if (p[v] == 0) p[x] = 1;
            if (p[v] == 1) p[x] = 0;
            que.push(x);
        }
    }
    return p;
}

vector<vector<ll> > comb(ll n, ll r) {
    vector<vector<ll> > v(n + 1, vector<ll> (n + 1, 0));
    rep(i, v.size()) {
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for (int j = 1; j < v.size(); j++) {
        for (int k = 1; k < j; k++) {
            v[j][k] = v[j - 1][k - 1] + v[j - 1][k];
        }
    }
    return v;
}


int main() {
    int x, y;
    cin >> x >> y;
    if (x != y) {
        cout << 3 - x - y << endl;
    }
    else {
        cout << x << endl;
    }
}