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

#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define M 1000000007
#define pb push_back
#define bg begin
#define pob pop_back
#define rep(x,y,j) for(ll j = x;j < y ;j++)
#define sz size
#define ss second
#define ff first
#define SUM accumulate
#define INF 2000000000000000000
#define SPACE " "
#define vr std::vector
#define que queue
#define dqu deque
#define stk stack
#define pqu priority_queue
#define mst multiset
#define pf push_front
#define pof pop_front
#define sqr(x) ((x)*(x))
#define cube(x) (x)*sqr(x)




void solve(){
  // std::cout << std::setprecision(9) << std::showpoint << std::fixed;
  ll x,y;
  cin >> x >> y;
  set <ll> s{0,1,2};
  if (x == y )
  {
    cout << x << endl;
    /* code */
  }
  else
  {
    s.erase(x);
    s.erase(y);
    cout << *(s.bg())<<endl;

  }

  

 





}
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int tt= 1;
  // cin >> tt;
  while (tt--) {
    solve();
    
    
  }
  return 0;
}