#include <bits/stdc++.h>
using namespace std;
int month(int m) {
  if (m == 1)
    return 31;
  else if (m == 2)
    return 28;
  else if (m == 3)
    return 31;
  else if (m == 4)
    return 30;
  else if (m == 5)
    return 31;
  else if (m == 6)
    return 30;
  else if (m == 7)
    return 31;
  else if (m == 8)
    return 31;
  else if (m == 9)
    return 30;
  else if (m == 10)
    return 31;
  else if (m == 11)
    return 30;
  else if (m == 12)
    return 31;
}
int main() {
  int m, d, x, i, temp, j, numoday;
  double ans;
  while (scanf("%d %d", &m, &d) != EOF) {
    numoday = (month(m) + (d - 1));
    ans = (double)numoday / 7;
    printf("%.0lf\n", ceil(ans));
  }
  return 0;
}
