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;
void Naser() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int toInt(string str) {
  int num;
  istringstream iss(str);
  iss >> num;
  return num;
}
template <class T>
string toStr(T par) {
  ostringstream oss;
  oss << par;
  return oss.str();
}
string toBinary(int n) {
  std::string r;
  while (n) {
    r = (n % 2 == 0 ? "0" : "1") + r;
    n /= 2;
  }
  return r;
}
int count_true_bits(int a) {
  int mask;
  int count = 0;
  for (mask = 1; mask; mask <<= 1) {
    if (mask & a) ++count;
  }
  return count;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
long double seq_pow_sum(long long n) {
  return (0.1666666667) * n * (n + 1) * (2 * n + 1);
}
int isPrime(int n) {
  int i;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (i = 3; i <= sqrt(n); i += 2)
    if (n % i == 0) return 0;
  return 1;
}
int main() {
  Naser();
  int x, y;
  cin >> x >> y;
  if (x == 1) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 2) {
    if (y > 1)
      return (cout << 5), 0;
    else
      return (cout << 4), 0;
  }
  if (x == 3) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 4) {
    if (y < 7)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 5) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 6) {
    if (y < 7)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 7) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 8) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 9) {
    if (y < 7)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 10) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 11) {
    if (y < 7)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
  if (x == 12) {
    if (y < 6)
      return (cout << 5), 0;
    else
      return (cout << 6), 0;
  }
}
