#include<bits/stdc++.h>
using namespace std;
#define setbits(x)      __builtin_popcountll(x)
#define leadzero(x)     __builtin_clz(x)
#define trailzero(x)    __builtin_ctz(x)
#define mod             1000000007
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , 
tree_order_statistics_node_update> ;
//find_by_order(index) -> value at the index  //  order_of_key(val) -> gives index of the key
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll              long long 
#define int             ll
#define ld              long double
#define ff              first
#define ss              second
#define pb              push_back
#define eb              emplace_back
#define popb            pop_back
#define endl            '\n'
#define all(v)          v.begin(), v.end()
#define sz(x)           ((int)((x).size()))
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<int, pii> pip;
typedef pair<pii, int> ppi;
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii;
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl;
typedef vector<string> vs;
ll power(ll a, ll b) {
    if(b<0) return 1;
    ll res=1;
    while(b) {
        if(b&1) 
            res = (res*a);//%mod;
        a = (a*a);//%mod;
        b >>= 1;
    }
    return res;
}
template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
bool ispoweroftwo(ll x){ return (x&&!(x&(x-1)));}
ll GCD(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
ll LCM(ll a, ll b) {return a / GCD(a, b) * b;}
const int inf = 1e9;
const ll INF = 1e18;
const ld pi = 3.141592653589793238;
int dx[] = {-1, 0, 1, 0}; 
int dy[] = {0, 1, 0, -1};
char MV[] = {'U', 'R', 'D', 'L'};
//integer to char always remember (char+'0')
//----------------------------------------------------------------------------------------
void solve() {
    int a, b; cin >> a >> b;

    a += b;
    if(a >= 15 && b >= 8) {
        cout << 1;
    }
    else if(a >= 10 && b >= 3) {
        cout << 2;
    }
    else if(a >= 3) {
        cout << 3;
    }
    else {
        cout << 4;
    }
}
int32_t main() {
    FIO;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    // int t; cin >> t; while(t--)
    solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int a, b;

int main() {
	std::ios::sync_with_stdio(0);
	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;
}
