#include<iostream>
using namespace std;
int main(){
    long long 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>
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define cerr if(1) cerr
#define ll long long
#define fp cout<<fixed<<setprecision(9);
#define loop(var,s,n) for(ll var=s ;var<n;var++)
#define rloop(var,s,n) for(ll var=s ;var>=n;var--)
#define pb push_back
#define endl '\n'
#define mk make_pair
#define all(x) x.begin(),x.end()
#define mod 1000000007
#define ipair pair<ll,pair<ll,ll>>
using namespace std;
int main() {

#ifdef KEVIN
	freopen("ingoing3.txt", "r", stdin);
	freopen("outgoing3.txt", "w", stdout);
	freopen("err3.txt", "w", stderr);
#endif
	FAST


	int t = 1;
	//cin >> t;

	while (t--)
	{
		int fat, nonfat, milk;
		cin >> nonfat >> milk;
		fat = nonfat + milk;
		if (fat >= 15 && milk >= 8)cout << 1;
		else if (fat >= 10 && milk >= 3)cout << 2;
		else if (fat >= 3)cout << 3;
		else cout << 4;
	}
	//cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
}