#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, d, num;
  cin >> m >> d;
  if (m == 1 || m == 3 | m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    num = d + 30;
    if (num % 7 == 0)
      num = num / 7;
    else
      num = (num / 7) + 1;
  } else if (m == 2) {
    num = d + 27;
    if (num % 7 == 0)
      num = num / 7;
    else
      num = (num / 7) + 1;
  } else {
    num = d + 29;
    if (num % 7 == 0)
      num = num / 7;
    else
      num = (num / 7) + 1;
  }
  cout << num;
  return 0;
}
