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

int judge(int a,int b){
  int c=a+b;
  if(c>=15&&b>=8){
    cout << 1 << endl;
  }
  else if(c>=10&&b>=3){
    cout << 2 << endl;
  }
  else if(c>=3){
    cout << 3 << endl;
  }
  else{
    cout << 4 << endl;
  }
  return 0;
}

int main(){
  int a,b;
  cin >> a >> b;
  judge(a,b);
}
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
inline void read(int& x){
	static char c;
	while(!isdigit(c=getchar()));x=c^48;
	while(isdigit(c=getchar()))x=(x*10)+(c^48);
}
inline void read(ll& x){
	static char c;
	while(!isdigit(c=getchar()));x=c^48;
	while(isdigit(c=getchar()))x=(x*10)+(c^48);
}

int A,B;

inline void Work(){
	read(A),read(B),A+=B;
	if(A>=15&&B>=8) return puts("1"),void();
	if(A>=10&&B>=3) return puts("2"),void();
	if(A>=3) return puts("3"),void();
	puts("4");
}

int main(){Work();}
