Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a calendar for January 2017 should look like on the picture:

<image>

Petr wants to know how many columns his table should have given the month and the weekday of the first date of that month? Assume that the year is non-leap.

Input

The only line contain two integers m and d (1 ≤ m ≤ 12, 1 ≤ d ≤ 7) — the number of month (January is the first month, December is the twelfth) and the weekday of the first date of this month (1 is Monday, 7 is Sunday).

Output

Print single integer: the number of columns the table should have.

Examples

Input

1 7


Output

6


Input

1 1


Output

5


Input

11 6


Output

5

Note

The first example corresponds to the January 2017 shown on the picture in the statements.

In the second example 1-st January is Monday, so the whole month fits into 5 columns.

In the third example 1-st November is Saturday and 5 columns is enough.
#include <bits/stdc++.h>
using namespace std;
int caseno = 1;
typedef long long LL;
typedef unsigned long long ULL;
typedef long long int64;
typedef unsigned long long uint64;
template <class T>
inline void SetMax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline void SetMin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline T MAX(T a, T b) {
  return (a > b) ? a : b;
}
template <class T>
inline T MIN(T a, T b) {
  return (a < b) ? a : b;
}
template <class T>
inline T SQRT(T x) {
  return x * x;
}
template <class T>
inline T FABS(T a) {
  return a < 0 ? a * (-1) : a;
}
template <class T>
inline void SWAP(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
template <class T>
bool Inside(T a, T b, T c) {
  return a <= b && b <= c;
}
inline LL POW(LL base, LL power) {
  LL I, res = base;
  if (power == 0) return 1;
  for (I = 0; I < power - 1; I++) res *= base;
  return res;
}
bool IsUpperCase(char c) { return c >= 'A' && c <= 'Z'; }
bool IsLowerCase(char c) { return c >= 'a' && c <= 'z'; }
bool IsVowel(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
          c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
}
bool IsLetter(char c) { return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; }
bool IsDigit(char c) { return c >= '0' && c <= '9'; }
char ToLowerCase(char c) { return (IsUpperCase(c)) ? (c + 32) : c; }
char ToUpperCase(char c) { return (IsLowerCase(c)) ? (c - 32) : c; }
int ToInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double ToDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
string ToString(int n) {
  string s;
  stringstream convert;
  convert << n;
  s = convert.str();
  return s;
}
const int SIZE = 50;
int ar[SIZE] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  std::ios_base::sync_with_stdio(0);
  int tcases, I, J, K, N, n, m, cnt = 0, len, d, x, y, r;
  cin >> m >> d;
  n = ar[m];
  x = 7 - d + 1;
  r = n - x;
  cnt = r / 7;
  y = r % 7;
  if (y != 0) cnt++;
  cnt++;
  cout << cnt << '\n';
  return 0;
}
