#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 <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int x, y;
	cin >> x >> y;
	if (x == y)
		cout << x;
	if (x != y) {
		if (x != 1 && y != 1)
		
			cout << 1;
		else
		if (x != 2 && y != 2)
			cout << 2;
		else

		if (x != 0 && y != 0)
			cout << 0;
	}
	return 0;
}