#include <bits/stdc++.h>

using namespace std;

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

typedef long long ll;
typedef vector<ll>vl1;
typedef vector<vl1> vl2;

struct struka
{ll val; ll ind;};
typedef vector<struka> vs;

bool compa(struka& a, struka& b)
{ if(a.val==b.val) return a.ind<b.ind;
  return a.val<b.val;
}

ll lova(vl1&  veka, ll dole, ll gore, ll val)
{ ll sred;
  while(dole<=gore)
  {sred=(gore+dole)/2;
   if(veka[sred]>=val) gore=sred-1;// real condition !
   else dole=sred+1;
  }
 return dole;
}

ll gcd(ll a,ll b)
{ll t;
  while (b)
  { t= b;
    b = a % b;
    a = t;
  }
return a;
}

void radi()
{ ll i, j, k, kn, m, n, p, t, l, r, x, y, z, a, b, c, d;
  ll val, pos, tmp, suma, maxa, mina, naso, num;
  string str1;
  char ch1;
  cin>>a>>b;
  c=(a+b)%3;
  val=(3-c)%3;
  cout<<val<<'\n';


}

int main()
{ /*
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(nullptr);
  cout<<fixed<<setprecision(15);
  */

  ll t, p;
  t=1;
  for(p=1;p<=t;p++) radi();
  return 0;
}
/*

*/
