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 dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
bool is_prime(long long x) {
  if (x <= 1) return false;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
bool is_palindrome(string s1) {
  int l = s1.length();
  for (int i = 0; i < l / 2; i++)
    if (s1[i] != s1[l - i - 1]) return false;
  return true;
}
unsigned long long C(long long n, long long k) {
  if (k == 0) return 1;
  return (n * C(n - 1, k - 1)) / k;
}
long long modular_pow(long long base, long long exponent, int modulus) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long binaryToDec(string number) {
  long long result = 0, pow = 1;
  for (int i = number.length() - 1; i >= 0; --i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
long long binaryToDec2(string number) {
  long long result = 0, pow = 1;
  int l = number.length();
  for (int i = 0; i < l; ++i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
string decimalToBin(int number) {
  if (number == 0) return "0";
  if (number == 1) return "1";
  if (number % 2 == 0)
    return decimalToBin(number / 2) + "0";
  else
    return decimalToBin(number / 2) + "1";
}
unsigned long long GCD(unsigned long long a, unsigned long long b) {
  return b == 0 ? a : GCD(b, a % b);
}
unsigned long long LCM(unsigned long long i, unsigned long long j) {
  return (i * j) / GCD(i, j);
}
int cntMask(int mask) {
  int ret = 0;
  while (mask) {
    if (mask % 2) ret++;
    mask /= 2;
  }
  return ret;
}
int getBit(int mask, int i) { return ((mask >> i) & 1) == 1; }
int setBit(int mask, int i, int value = 1) {
  return (value) ? mask | (1 << i) : (mask & ~(1 << i));
}
unsigned long long mystoi(string s) {
  unsigned long long ans = 0;
  unsigned long long po = 1;
  for (int i = s.length() - 1; i >= 0; i--) {
    ans += (s[i] - '0') * po;
    po *= 10;
  }
  return ans;
}
string conv(int i) {
  string t = "";
  while (i) {
    t += '0' + (i % 10);
    i /= 10;
  }
  return t;
}
bool hasZero(int i) {
  if (i == 0) return true;
  while (i) {
    if (i % 10 == 0) return true;
    i /= 10;
  }
  return false;
}
bool isSortedAc(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] > a[i + 1]) return false;
  return true;
}
bool isSortedDec(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] < a[i + 1]) return false;
  return true;
}
bool cmp(unsigned long long i, unsigned long long j) { return i > j; }
void A() {
  int m, d;
  cin >> m >> d;
  map<int, int> mpp;
  mpp[1] = 31;
  mpp[2] = 28;
  mpp[3] = 31;
  mpp[4] = 30;
  mpp[5] = 31;
  mpp[6] = 30;
  mpp[7] = 31;
  mpp[8] = 31;
  mpp[9] = 30;
  mpp[10] = 31;
  mpp[11] = 30;
  mpp[12] = 31;
  int total = d - 1;
  int ans = 0;
  int x = mpp[m];
  for (int i = 0; i < int(x); i++) {
    if (total >= 7) {
      ans++;
      total %= 7;
    }
    total++;
  }
  ans += (total > 0);
  cout << ans << endl;
  return;
}
void B() { return; }
int main() {
  ios_base::sync_with_stdio(false);
  A();
  return 0;
}
