#include<bits/stdc++.h>
#include<vector>
#include <iostream>
using namespace std;
using ll = long long;

int main()
{
	int x, y;
	cin >> x >> y;

	if (x != y){
            cout << 3 - x - y << endl;
        }else{
            cout << x << endl;
                }
	return 0;
}

//

#include <iostream>
#include <string>


using namespace std;


int main() {
  int x, y;
  cin >> x >> y;

  if (x == y)
    cout << x << "\n";

  else {
    if ((x + 1) % 3 != y) {
      cout << ((x+1) % 3) << "\n";
    }
    else {
      cout << ((y+1) % 3) << "\n";
    }
  }
    
  return 0;
}
