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

// ---------- Debugger

#define TRACE

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(char c) {
    return '\'' + string(1, c) + '\'';
}

string to_string(char * s) {
    return to_string((string) s);
}

string to_string(const char * s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template < typename A >
string to_string(A v);

template < typename A, typename B >
string to_string(pair < A, B > p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template < typename C > struct rge { C b, e; };
template < typename C > rge<C> range(C i, C j) { return rge<C>{i, j}; }

template < typename C > 
string to_string(rge<C> v) {
    bool first = true;
    string res = "[";
    for(auto it = v.b; it != v.e; it++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(*it);
    }
    res += "]";
    return res;
}

template < typename A >
string to_string(A v) {
    return to_string(range(v.begin(), v.end()));
}

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Head >
void __f(const string names, Head arg1) {
    cerr << names << " : " << to_string(arg1) << endl;
}
template < typename Head, typename...Tail >
void __f(const string names, Head arg1, Tail...args) {
    int b = 0, comma = names.size();
    for(int i=0;i<names.size();i++) {
        if(names[i] == ',' && b == 0) {
            comma = i;
            break;
        }
        if(names[i] == '(' || names[i] == '{' || names[i] == '[' || names[i] == '<') b++;
        else if(names[i] == ')' || names[i] == '}' || names[i] == ']' || names[i] == '>') b--;
    }
    // size_t comma = names.find(', ');
    cerr << names.substr(0, comma) << " : " << to_string(arg1) << " | ";
    __f(names.substr(comma + 1), args...);
}
#else
#define trace(...)
#endif

// ---------- Debugger

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 9;
const int MX = (int)1e5 + 5;

int main() {
    int a,b;
    cin >> a >> b;

    int ms = a + b;

    if(ms >= 15 && b >= 8) {
        cout << 1;
    }   
    else if(ms >= 10 && b >=3) {
        cout << 2;
    }
    else if(ms >= 3) {
        cout << 3;
    }
    else {
        cout << 4;
    }
    cout << endl;


    return 0;
}























#include<iostream>
#include<bits/stdc++.h>
#define ll long long
#define REP(s,n) for(int i=s;i<n;i++)
#define IOS ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define ee "\n"
using namespace std;
void slove()
{
    ll a,b;
    cin>>a>>b;
    ll ansa = 0,ansb=0;
    a=a+b;
    if(a>=15)	ansa=1;
    else if(a>=10 && a<15)	ansa=2;
    else if(a>=3 && a<10)	ansa=3;
    else	ansa=4;

    if(b>=8)	ansb=1;
    else if(b>=3 && b<8)	ansb=2;
    else if(b>=0 && b<3)	ansb=3;
    else ansb=4;
    cout<<max(ansa,ansb)<<"\n";
}
int main()
{
    IOS
    int t=1;
    //cin>>t;//For test case
    while(t--){
       slove();
    }
    return 0;
}
