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

int main () {
    int a, b;
    cin >> a >> b;
    int ans = a + b;
    if (ans >= 15 && b >= 8) {
        cout << 1 << endl;
    }
    else if (ans >= 10 && b >= 3) {
        cout << 2 << endl;
    }
    else if (ans >= 3) {
        cout << 3 << endl;
    }
    else {
        cout << 4 << endl;
    }

}
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define po pop_back
#define mp make_pair
#define fi first
#define se  second
#define LLM LONG_LONG_MAX
#define LLm LONG_LONG_MIN
#define hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
using namespace std;
bool comp(ll a,ll b){if(a>b)return true;else return false;}
int isP(ll n){if(n==1)return 0;if(n==2 || n==3)return 1;for(ll i=2;i<=sqrt(n);i++){if(n%i==0)return 0;}return 1;}
ll power(ll a,ll b){if(b==0)return 1;if(b==1) return a;ll t=power(a,b/2);if(b%2==1) return t*t*a;else return t*t;}
ll powMOD(ll x,ll y){if(y==0)return 1;if(y==1)return x;ll t=powMOD(x,y/2);if(y%2==1)return t*t%MOD*x%MOD;else return t*t%MOD;}

int main()
{
    /*//----Hello World----//*/
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    hello;
    
    ll t;
//    cin>>t;
    t=1;
    while(t--){
    	ll a,b;
    	cin>>a>>b;
    	ll vala=a+b;
    	ll valb=b;
    	ll ans;
    	if(vala>=15 && valb>=8) ans=1;
    	else if(vala>=10 && valb>=3) ans=2;
    	else if(vala>=3) ans=3;
    	else ans=4;
    	cout<<ans<<"\n";
	}
    
	/*//----Hello World----//*/
    return 0;  
}
