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

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

#define   fi(a,b) for(int i=a;i<b;i++)
#define   fj(a,b) for(int j=a;j<b;j++)
#define   ff first
#define   ss second
#define   ll long long
#define   ld long double
#define   ull unsigned long long
#define   bp(x) __builtin_popcount(x)
#define   pr(x) for(auto it: x) cout<<it<<" "; cout<<endl;
#define   getMax(x) max_element(x.begin(),x.end())
#define   getMin(x) min_element(x.begin(),x.end())
#define   endl "\n"
typedef   vector<int> vi;
typedef   vector< pair<int,int> > vii;
typedef   vector<long long> vl;
typedef   pair<int,int> pii;
typedef   pair<ll,ll> pll;
typedef   vector< pair<ll,ll> > vll;
//int dx[]={1,0,-1,0};
//int dy[]={0,1,0,-1};
//int dx[]={-1,0,1,1,1,0,-1,-1};
//int dy[]={-1,-1,-1,0,1,1,1,0};

void nikal_pehli_fursat_mai(){
    ll a, b;
    cin>>a>>b;
    a += b;
    if(a>=15 and b>=8) cout<<1<<endl;
    else if(a>=10 and b>=3) cout<<2<<endl;
    else if(a>=3) cout<<3<<endl;
    else cout<<4<<endl;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tc=1; 
    // cin>>tc;
    while(tc--){
    nikal_pehli_fursat_mai();
    }
}
