#include <iostream>
using namespace std;

int main() {
	 int a, b;
   cin>>a>>b;
   if(a+b>=15 && b>=8){
      cout<<1;
   }else if(a+b>=10 && b>=3){
      cout<<2;
   }else if(a+b>=3){
      cout<<3;
   }else{
     cout<<4;
   }
}

#include <bits/stdc++.h>
// #include "atcoder/all"
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const ll INF = (ll)1e18;
void chmin(ll &a, ll b) { a = min(a, b); }
void chmax(ll &a, ll b) { a = max(a, b); }

void solve() {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    int c = a+b;
    if (c >= 15 && b >= 8) ans = 1;
    else if (c >= 10 && b >= 3) ans = 2;
    else if (c >= 3) ans = 3;
    else ans = 4;
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}
