#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(x,y) for(ll i=x;i<y;i++)
#define vll vector<ll>
#define sll set<ll>
#define pb push_back
#define in insert
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define tc ll t;cin>>t;while(t--)
#define rev(x) reverse(all(x))
#define low_str(x) transform(all(x),x.begin(),::tolower)
#define up_str(x) transform(all(x),x.begin(),::toupper)
#define to_digit(c) c-'0';
int main()
{

// #ifndef masterpranay
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif

    ll a, b; cin >> a >> b;
    if(b >= 8 && a+b >= 15)
    {
        cout << 1;
    }
    else if(b >= 3 && a+b >= 10)
    {
        cout << 2;
    }
    else if(a+b >= 3)
    {
        cout << 3;
    }
    else
    cout << 4;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a+b>=15&&b>=8)
	cout<<"1";
	else if(a+b>=10&&b>=3)
	cout<<"2";
	else if(a+b>=3)
	cout<<"3";
	else cout<<"4";
	return 0;
}