// Problem: A - Rock-paper-scissors
// Contest: AtCoder - AtCoder Beginner Contest 204
// URL: https://atcoder.jp/contests/abc204/tasks/abc204_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms

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

int main() {
	int x, y;
	cin >> x >> y;
	if (x == y) cout << x;
	else cout << 3 - x - y;
	return 0;
}
#include<iostream>

using namespace std;


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

    if ((x==1&&y==2)||(x==2&&y==1)||(x==0&&y==0)) cout<<0;
    else if ((x==0&&y==2)||(x==2&&y==0)||(x==1&&y==1)) cout<<1;
    else cout<<2;
    return 0;
}