#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define loop(i,l,n)for(int i=l;i<n;i++)
#define dloop(i,l,n)for(int i=l;i>=n;i--)
#define read(x) cin>>x
#define print(x) cout<<x
bool compare(pair<int,int>p1,pair<int,int>p2){
  if(p1.first>p2.first)return true;
  else if(p1.first==p2.first){
    if(p1.second<p2.second)return true;
  }
  return false;
}
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
  cin.tie(NULL);
ll 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';
  return 0;

}
  

 
  

 


 
  

 


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


int main()
{
    int A, B;
    cin >> A >> B;

    int type = -1;
    if ((A + B >= 15) && (B >= 8)) {
        type = 1;
    }
    else if ((A + B >= 10) && (B >= 3)) {
        type = 2;
    }
    else if ((A + B >= 3)) {
        type = 3;
    }
    else {
        type = 4;
    }

    cout << type << endl;
}
