#include <bits/stdc++.h> 
#define Rajpoot ios_base::sync_with_stdio(0);   cin.tie(0);  cout.tie(0);
#define ll long long
#define loo(i,n) for(i=0;i<n;i++)
#define go(i,sp)  for(auto i=sp.begin();i!=sp.end();i++)
#define pb push_back
#define lb lower_bound
#define mo 1000000007
#define pi 3.14159265358979323846264338327950288419716939937510582
#define exp 2.71828182845904523536028747135266249775724709369995957
#define endl "\n"
using namespace std;



int main() 
{
   Rajpoot
      //    freopen("input.txt","r",stdin);
      // freopen("output.txt","w",stdout);

    //int t; cin>>t; 
   int t=1;
    while(t--)
    { 
        ll a,b;
        cin>>a>>b; a=a+b;
        if(a>=15 && b>=8) cout<<1<<endl;
        else if(a>=10 && b>=3) cout<<2<<endl;
        else if(a>=3) cout<<3<<endl;
        else cout<<4<<endl;
        
    }    

	return 0;
}
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
#define mod(n) (n) % 1000000007
#define sp << " "
#define ff first
#define ss second
#define precision(n) cout << fixed << setprecision(n);
#define startTime time_t start, end;time(&start);
#define endTime time(&end);double tt = double(end-start);cout<<"Time taken : "<<fixed<<tt<<setprecision(5);cout <<" sec"<< endl;

using namespace std;

int main() {
    IOS;
    ll 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;
}