#include <bits/stdc++.h>
using namespace std;
/* ループ処理 0からnまで*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

#define ll long long int
#define ull unsigned long long
#define vi vector <int>
#define vll vector <long long int>
#define pb push_back
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define time cerr << "Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" sec"<<endl;
#define sp " "
#define chk cout << "Alhamdulillah" << endl;
#define nl endl

int main ()
{
  FIO;
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  freopen("error.txt", "w", stderr);
  #endif

  int x, y, z;
  cin >> x >> y;

  if(x == y) z = x;
  else{
  	if(x + y == 3) z = 0;
  	if(x + y == 2) z = 1;
  	if(x + y == 1) z = 2;
  }
  cout << z << nl;


  
  time;
  return 0;
}