#include <bits/stdc++.h>
using namespace std;
int main(){
  int 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;

}

// include
#include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

//型短縮
#define ll long long

//マクロ定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int A, B;
  cin >> A >> B;
  int nyuko = A + B;
  if (nyuko >= 15 && B >= 8) {
    cout << 1;
  } else if (nyuko >= 10 && B >= 3) {
    cout << 2;
  } else if (nyuko >= 3) {
    cout << 3;
  } else {
    cout << 4;
  }
}