#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define fore(i_in,a) for (auto& i_in: a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fio() cin.tie(nullptr);ios::sync_with_stdio(false);
#define DEBUG_CTN(v) cerr<<#v<<":";for(auto itr=v.begin();itr!=v.end();itr++) cerr<<" "<<*itr; cerr<<endl
template<class T> bool chmax(T &a, const T &b) {if (a<b) { a = b; return true; } return 0;}
template<class T> bool chmin(T &a, const T &b) {if (a>b) { a = b; return true; } return 0;}
template<class T> void print(const T &t) { cout << t << "\n"; }
const ll INF = 1LL << 60;

ll a, b, ans;

int main() {
    fio(); cin>>a>>b;
    if(a+b>=15 and b>=8) print(1);
    else if(a+b>=10 and b>=3) print(2);
    else if(a+b>=3) print(3);
    else print(4);
}

#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;
    }
}