#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[]={15,10,3,0};
  int b[]={8,3,0,0};
  int p,q;
  cin>>p>>q;
  p+=q;
  int i,j;
  for(i=0;i<4;i++)
  {
    if(p>=a[i])
      break;
  }
  for(j=0;j<4;j++)
  {
    if(q>=b[j])
      break;
  }
  int ps=max(i,j);
  cout<<ps+1<<"\n";  
  return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int A, B;
    cin >> A >> 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;
}
