#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair 
#define tc int tt;cin >> tt;for (int ti = 1; ti <= tt; ti++)
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ranked_pairset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ranked_set;

int main() {
    int x, y;
    cin >> x >> y;
    if (x == y)
        cout << x;
    else 
        cout << 3 - x - y;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  int answer;
  if (x == y) answer = x;
  else if (x == 0 && y == 1) answer = 2;
  else if (x == 1 && y == 0) answer = 2;
  else if (x == 1 && y == 2) answer = 0;
  else if (x == 2 && y == 1) answer = 0;
  else if (x == 0 && y == 2) answer = 1;
  else if (x == 2 && y == 0) answer = 1;
  
  cout << answer;
}
    