#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m, d;
  cin >> m >> d;
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    int x = d + 30;
    int y = x / 7;
    if (x % 7) y++;
    cout << y;
  } else if (m == 2) {
    int x = d + 27;
    int y = x / 7;
    if (x % 7) y++;
    cout << y;
  } else {
    int x = d + 29;
    int y = x / 7;
    if (x % 7) y++;
    cout << y;
  }
}
