#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define no cout<<"NO\n";
#define yes cout<<"YES\n";
#define nl cout<<"\n";
#define sp <<" "<<
#define ull unsigned long long
#define FAST  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
using namespace std;
bool pr(int n){
    if (n <= 1)
        return 0;
    for (ll i=2;i*i<=n;i++)
        if (n%i == 0)
            return 0;
    return 1;
}
int main()
{
    FAST
    ll a,b;cin>>a>>b;
    if(a+b>=15 && b>=8){
    	cout<<1<<endl;
	}
	else if(a+b>=10 &&b>=3)
	{
		cout<<2<<endl;
	}
	else if((a+b)>=3){
		cout<<3<<endl;
	}
	
	else{
		cout<<4<<endl;
	}
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  if(N == L){
    cout << N << endl;
  }else if(N != 0 && L != 0){
    cout << 0 << endl;
  }else if(N != 1 && L != 1){
    cout << 1 << endl;
  }else{
    cout << 2 << endl;
  }
  return 0;
}