#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a+b>=15&&b>=8)
    {
        cout<<1;
        return 0;
    }
    else if(a+b>=10&&b>=3)
    {
        cout<<2;
        return 0;
    }
    else if(a+b>=3)
    {
        cout<<3;
        return 0;
    }
    else
    {
        cout<<4;
        return 0;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define lld long double
#define inf 1000000000
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define mod2 998244353
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; ++i)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define w(x)  int x; cin>>x; while(x--)
#define in(a) for(auto &x: a)cin>>x;
void print(bool n){if(n)cout<<"YES\n";else cout<<"NO\n";}
signed main(){
    fastio
	int a,b;
	cin>>a>>b;
	if(a+b>=15 && b>=8)cout<<1<<'\n';
	else if(a+b>=10 && b>=3)cout<<2<<'\n';
	else if(a+b>=3)cout<<3<<'\n';
	else cout<<4<<'\n';
}