#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    int ans = 4;
    if(A+B>=15 && B>=8) ans = 1;
    else if(A+B>=10 && B>=3) ans = 2;
    else if(A+B>=3) ans = 3;
    cout << ans << endl;

}
#include <bits/stdc++.h>
using namespace std;
#define fo(a,b) for(int64_t a=0;a<b;a++)
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define ll int64_t
#define mod 1000000007
#define vl vector<int64_t>
#define vc vector<char>
#define vs vector<string>
#define np(vec) next_permutation(vec.begin(),vec.end())==true
#define en endl
#define vvl vector<vector<int64_t>>
#define stl stack<int64_t>
#define qul que<int64_t>
#define ms(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pq priority_queue
#define pql priority_queue<int64_t>
#define pu push
#define po pop()
#define to top()
#define pqr priority_queue<ll,vector<ll>,greater<ll>>
#define co cout
#define ci cin
#define wh while
#define size size()

int main() {
  ll a,b;
  cin>>a>>b;
  if(a+b>=15&&b>=8){cout<<1<<en;}
  else if(a+b>=10&&b>=3){co<<2<<en;}
  else if(a+b>=3){cout<<3<<en;}
  else{cout<<4<<en;}
}