#include <bits/stdc++.h>
using namespace std;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int n, m;
  cin >> n >> m;
  n = month[n] + m - 1;
  if (n % 7 != 0)
    cout << n / 7 + 1;
  else
    cout << n / 7;
  return 0;
}
