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;
vector<vector<long long>> g(1000);
long long tre[1000];
long long aa[1000];
bool mark[1000];
long long par[1000];
queue<long long> q;
long long a, b, c, d, m, n, i;
void bldtr(long long l, long long r, long long k) {
  if (l == r)
    tre[k] = aa[l];
  else {
    bldtr(l, (l + r) / 2, k * 2);
    bldtr((l + r) / 2 + 1, r, k * 2 + 1);
    tre[k] = tre[2 * k] + tre[2 * k + 1];
  }
}
long long sumtr(long long tl, long long tr, long long l, long long r,
                long long v) {
  if (l > r) return 0;
  if (tl == l && tr == r) return tre[v];
  return sumtr(tl, (tl + tr) / 2, l, min(r, (tl + tr) / 2), 2 * v) +
         sumtr((tl + tr) / 2 + 1, tr, max(l, (tl + tr) / 2 + 1), r, 2 * v + 1);
}
void updatetr(long long v, long long tl, long long tr, long long pos,
              long long val) {
  if (tl == tr)
    tre[v] = val;
  else {
    if (pos <= (tl + tr) / 2)
      updatetr(2 * v, tl, (tl + tr) / 2, pos, val);
    else
      updatetr(2 * v + 1, (tl + tr) / 2 + 1, tr, pos, val);
    tre[v] = tre[2 * v] + tre[2 * v + 1];
  }
}
long long ddeg(long long a, long long n) {
  if (n == 1) return a;
  if (n == 0) return 1;
  return ddeg(a, n / 2) * ddeg(a, (n / 2 + n % 2));
}
void dfs(long long a) {
  mark[a] = true;
  for (long long i = 0; i < g[a].size(); i++) {
    if (mark[g[a][i]] != true) dfs(g[a][i]);
  }
}
long long bfs(long long a, long long b) {
  if (a == b) return b;
  mark[a] = true;
  q.push(a);
  long long k = 0;
  while (!q.empty()) {
    long long s = q.size();
    k++;
    for (long long j = 0; j < s; j++) {
      a = q.front();
      q.pop();
      for (i = 0; i < g[a].size(); i++) {
        if (g[a][i] == b) return k;
        if (mark[g[a][i]] != true) q.push(g[a][i]);
      }
    }
  }
}
void makeset(long long a) { par[a] = a; }
long long fndpar(long a) {
  if (par[a] == a) return a;
  return par[a] = fndpar(par[a]);
}
void combset(long long a, long long b) {
  a = fndpar(a);
  b = fndpar(b);
  if (a != b) {
    par[a] = b;
  }
}
int main() {
  cin >> m >> d;
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
    m = 31;
  else if (m == 2)
    m = 28;
  else
    m = 30;
  m -= (7 - d + 1);
  a++;
  a += (m / 7);
  if (m % 7 != 0) a++;
  cout << a;
}
