#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;
}
//by azidoazideazide(C2N14)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for (ll i = a; i < (b); i++)
#define FORE(i, a, b) for (ll i = a; i <= (b); i++)
void listv(int st, int ed, vector<int> v);

ull llpow(ull x, ull y){
	if(y==0) return 1;
	ull tt=llpow(x,y>>1);
	return (y&1) ? x*tt*tt : tt*tt; 
}

//ifstream fin("test1.txt");
//ofstream fout("test1.txt");

int main(){
//	ios::sync_with_stdio(0), cin.tie(0);
	int fat, solid, b;
	cin>>b>>fat;
	solid=b+fat;
	if(solid>=15 && fat>=8) puts("1");
	else if(solid>=10 && fat >=3) puts("2");
	else if(solid>=3) puts("3");
	else puts("4");
}

void listv(int st, int ed, vector<int> v){
	FORE(i, st, ed) cout<<v[i]<<' '; cout<<endl; 
}