#include<iostream>
using namespace std;

int main(){
  float 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;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main() {
  //input
  int A, B;
  cin >> A >> B;
  //calc
  int C = A + B;
  int answer = 0;
  if ( C >= 15 && B >= 8 ) {
    answer = 1;
  }
  else if ( C >= 10 && B >= 3 ) {
    answer = 2;
  }
  else if ( C >= 3 ) {
    answer = 3;
  }
  else {
    answer = 4;
  }
  //output
  cout << answer << endl;
}