/* dont stick to an approach */
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

#define PB push_back

#define For(i, n) for (ll i = 0; i < n; i++)

#define PYES cout<<"YES\n"
#define PNO cout<<"NO\n"
#define PYes cout<<"Yes\n"
#define PNo cout<<"No\n"

#define vll             vector<ll>
#define rev(v)          reverse(v.begin(),v.end())
#define srt(v)          sort(v.begin(),v.end())
#define grtsrt(v)       sort(v.begin(),v.end(),greater<int>())
#define mnv(v)          *min_element(v.begin(),v.end())
#define mxv(v)          *max_element(v.begin(),v.end())
#define all(v)          v.begin(),v.end()

#define Fas ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

const int M= 1e9 +7;

//--------------------------------------------functions-------------------------------------------------//

ll power(ll a,ll b){int result=1;while(b>0){if(b%2 == 1){result *= a;} a *= a;b /= 2;}return result;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;}
bool isPerfectSquare(ll n){ll sr = sqrt(n);if (sr * sr == n)return true;else return false;}
ll mod(ll x){return ((x%M + M)%M);}
ll add(ll a, ll b){return mod(mod(a)+mod(b));}
ll mul(ll a, ll b){return mod(mod(a)*mod(b));}
ll powerM(ll a,ll b){ll res=1;while(b){if(b%2==1){res=mul(a,res);}a=mul(a,a);b/=2;}return res;}
//------------------------------------sieve of erantothenes-----------------------------------------------//

vector<bool> sieve_of_eratothenes(ll n){
    vector<bool> a(n+1,1);
    a[0]=0;
    a[1]=0;
    for(ll i=2;i<=sqrt(n);i++){
        if(a[i]==1){
            for(ll j=2;i*j<=n;j++){
                a[j*i]=0;
            }
        }
    }
    return a;
}
//----------------------------------------nCr mod------------------------------------------------------//
ll modInverse(ll n){
    return powerM(n,M-2);
}
ll nCrM(ll n,ll r){
    if(n<r) return 0;
    if(r==0) return 1;
    vector<ll> fact(n+1);
    fact[0]=1;
    for(ll i=1;i<=n;i++){
        fact[i]=mul(fact[i-1],i);
    }
    return mul(mul(fact[n],modInverse(fact[r])),modInverse(fact[n-r]));
}
//-----------------------------------------------solve-----------------------------------------------------//
void solve(){
    ll a,b;cin>>a>>b;
    if(a+b>=15 && b>=8){
        cout<<1<<endl;
    }else if(a+b>=10 && b>=3){
        cout<<2<<endl;
    }else if(a+b>=3){
        cout<<3<<endl;
    }else{
        cout<<4<<endl;
    }
}
int main(){
    Fas;

//    ll t=0;
//    cin>>t;
//    while(t--)
        solve();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int a, b;
int 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");
}