#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

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

	if (x == y)
	{
		cout << x << endl;
	}
	else
	{
		cout << (0 ^ 1 ^ 2 ^ x ^ y) << endl;
	}

	return 0;
}
#include<stdio.h>
int main(void)
{
	int x, y;
	int z;
	
	
	scanf("%d %d", &x, &y);
	
	if(x == y){
		z = x;
	}
	
	else if(x != y){
		z = 3 - (x+y);
	}
	
	printf("%d",z);
	return(0);
}
