#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==b)
	cout<<a<<endl;
	else
	cout<<3-a-b<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b; cin >> a >> b;
  if (a > b) swap(a, b);
  if (a == b) cout << a << '\n';
  else if (a == 0 and b == 1) cout << 2 << '\n';
  else if (a == 0 and b == 2) cout << 1 << '\n';
  else cout << 0 << '\n';
  return 0;
}