#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 <cstddef>
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <cstring>
#include <cstdint>
#include <tuple>
#include <fstream>
#include <numeric>

/*** MACRO and TYPE DEFINES ***/
#define rep(i, n) \
	for (int i = 0; i < n; i++)

using ll = long long;
using P = std::pair<int, int>;

/*** CONST DEFINES ***/
const long long MOD = 998244353;
// const long long MOD = 1000000007;
const ll INF64 = 9000000000000000000;
const int INF32 = 1000000000;

/*** UTILITY CLASS ***/

/*** FUNCTIONS ***/

/*** GLOVAL VALIABLES ***/

/*** EXECUTE ***/

int main(void)
{
#if 0
	//ファイルから読み込みたいとき
	std::ifstream in();
	std::cin.rdbuf(in.rdbuf());
#endif
	int x, y;
	std::cin >> x >> y;

	int z = 0;
	if (x == y)
	{
		z = x;
	}
	else
	{
		int te[] = {0, 1, 2};
		te[x] -= 100;
		te[y] -= 100;
		rep(i, 3)
		{
			if (te[i] >= 0)
			{
				z = te[i];
				break;
			}
		}
	}

	std::cout << z << std::endl;

	return 0;
}