
//help others........
#include <iostream>
#include<bits/stdc++.h>
using namespace std;

#define ll long long 
#define lli long long int
#define pb push_back  
#define F first
#define S second
#define pii pair<long long,int>
#define all(a) a.begin(),a.end()
#define read(n,a) for(int i = 0;i<n;i++){cin>>a[i];}

ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll mod = 1e9+7;

ll fct[1009];

int N = 509;
	

void fact() {
	fct[0] = 1;
	fct[1] = 1;
	for (ll i = 2; i <= 1000; i++)  
		fct[i] = (i * fct[i-1])%mod;
}

bool find(int s,vector<int>a){

	for(int i = 0;i<(int)a.size();i++)
	{
		if(a[i] == s)
			return true;
	}
	return false;
	
}
void getans()
{	
	int a,b;
	cin>>a>>b;
	int c = a+b;
	
	if(c>=15 && b >=8)
		cout<<1<<endl;
	else if(c>=10&& b>=3)
		cout<<2<<endl;
	else if(c>=3)
		cout<<3<<endl;
	else
		cout<<4<<endl;
	
} 


int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1;
	//cin>>t;
	while(t--)
		getans();
	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\n";
  }else if(a+b>=10&&b>=3){
    cout<<"2\n";
  }else if(a+b>=3){
    cout<<"3\n";
  }else{
    cout<<"4\n";
  }
}