#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int A, B;

void MAIN() {
    scanf("%d%d", &A, &B);
    if (A+B >= 15 && B >= 8) {
	puts("1");
    } else if (A+B >= 10 && B >= 3) {
	puts("2");
    } else if (A+B >= 3) {
	puts("3");
    } else {
	puts("4");
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}


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

#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define inf INT_MAX
#define llinf LLONG_MAX
#define mt make_tuple
#define mp make_pair
#define parll pair<ll,ll>
#define parii pair<int,int>
#define min3( brp1, brp2, brp3 ) min( min( brp1, brp2 ), brp3 )
#define min4( brp1, brp2, brp3, brp4 ) min( min( brp1, brp2 ), min( brp3, brp4 ) )

ll a,b;

int main()
{
    ios;

    cin >> a >> b;

    if ( a+b >= 15 && b >= 8 )
    {
        cout << 1;
        return 0;
    }
    if ( a+b >= 10 && b >= 3 )
    {
        cout << 2;
        return 0;
    }
    if ( a+b >= 3 )
    {
        cout << 3;
        return 0;
    }
    cout << 4;

    return 0;
}
