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

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef float flt;

#define for0(i, n) for(ll i=0; i<n; i++)
#define for1(i, n) for(ll i=1; i<=n; i++)
#define forab(i, a, b) for(ll i=a; i<=b; i++)
#define clr0(a) memset(a, 0, sizeof(a))

void solve() {
    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;
    }
}

void testcase() {
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}

int main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //testcase();
    solve();

    return 0;
}


#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;


int main() {
  int a , b ;
  cin >> a >> b ;
  if((a+b)>=15 && b>=8)
  {
      cout << 1 ; /// "ice cream";
      return 0;
  }
  if((a+b)>=10 && b>=3)
  {
      cout << 2 ; /// "1 ice milk";
      return 0;
  }
  if((a+b)>=3)
  {
      cout << 3 ; // "lacto milk";
      return 0;
  }
  cout << 4 ; /// "flavored ice";
  return 0;
}
