#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;

#define REP(i,b,e) for(int i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second

const int MOD = 1e9+7;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	a += b;
	if(a>=15 && b>=8) puts("1");
	else if(a>=10 && b>=3) puts("2");
	else if(a>=3) puts("3");
	else puts("4");
	return 0;
}


#include <bits/stdc++.h>
using namespace std; 

int main(){
  
  int ms, nfms, mf;
  
  cin >> nfms >> mf;
  
  ms = nfms + mf;
  
  if(ms >= 15 && mf >= 8){
    cout << 1 << endl;
  }
  else if(ms >= 10 && mf >= 3){
    cout << 2 << endl;
  }
  else if(ms >= 3){
    cout << 3 << endl;
  }
  else{
    cout << 4 << endl;
  }
  
}