#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, y;
    cin >> x >> y;
    if(x == 0 && y == 1) {
        cout << '2';
    } else if(x == 1 && y == 0) {
        cout << '2';
    } else if(x == 1 && y == 2) {
        cout << '0';
    } else if(x == 0 && y == 2) {
        cout << '1';
    } else if(x == 2 && y == 1) {
        cout << '0';
    } else if(x == 2 && y == 0) {
        cout << '1';
    } else {
        cout << x;
    }
}
#include<bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
using namespace std;
 
int main () {
    FASTIO;
    int n,m;
        cin>>n>>m;
        int ans=0;
        if(n==m) {
            cout<<m;
        }
        else {
            cout<<3-n-m;
        }
     
        
       
        
    
}