#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 359; i < (int)(n); i++)

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

{
  int a,b,c;
  cin>>a>>b;
  if(a==1 &&b==0||a==0&&b==1)
    cout<<2;
  else if(a==b)
    cout<<a;
  else if(a==1 &&b==2||a==2 &&b==1)
    cout<<0;
  else
    cout<<1;

}
