#include <iostream>
using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    if(x + y> 14 and y > 7){
        cout << "1";
    } else if (x + y > 9 and y > 2){
        cout << "2";
    } else if (x + y > 2 and y >= 0){
        cout << "3";
    } else {
        cout << "4";
    }

    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono>
#include <typeinfo>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds; 
#define lli long long int
#define fr(i,a,b) for(lli i=a;i<b;i++)
#define bfr(i,a,b) for(lli i=a;i>=b;i--)
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
#define tc int t;cin>>t;while(t--)
//#define mod 1000000007LL
#define mod2 998244353LL
#define PI  3.14159265359
#define all(vec) vec.begin(),vec.end()  
#define ld long double
#define pb push_back
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 
lli pmod(lli x,lli y,lli mod){lli res=1;while(y>0){if(y&1)res = ((res%mod)*(x%mod))%mod;y>>=1;x= ((x%mod)*(x%mod))%mod;}return res;} 
lli power(lli x,lli y){lli res=1;while(y>0){if(y&1)res=res*x;y>>=1;x=x*x;}return res;}

lli gcd(lli a , lli b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}



int main()
{

         

    fio

    lli a,b;
    cin>>a>>b;
    if(a+b>=15 && b>=8)
    cout<<1;
    else if(a+b>=10 && b>=3)
    cout<<2;
    else if(a+b>=3)cout<<3;
    else cout<<4; 






    
    

    
            

    
    
    

    

    
    



    





    

    




    return 0;}        
