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 ll = long long;
template <typename T>
using vec = std::vector<T>;
template <typename T, typename U>
inline bool chmax(T& x, U a) {
  return x < a && (x = a, 1);
}
template <typename T, typename U>
inline bool chmin(T& x, U a) {
  return a < x && (x = a, 1);
}
template <typename T = int>
inline T in() {
  T x;
  std::cin >> x;
  return x;
}
template <typename T = int, typename V = vec<T> >
inline V reserved(int n) {
  V v;
  v.reserve(n);
  return v;
}
template <typename T = int>
inline vec<T> in(int n) {
  auto v = reserved<T>(n);
  for (int i = (0); i < (int)(n); ++i) v.emplace_back(in<T>());
  return v;
}
template <typename T, typename U = std::pair<T, int> >
inline vec<U> enume(const vec<T>& x, int s = 0) {
  int N = x.size();
  auto v = reserved<U>(N);
  for (int i = (0); i < (int)(N); ++i) v.emplace_back(x[i], s + i);
  return v;
}
template <typename T>
inline vec<T> ndvec(T v, int n) {
  return vec<T>(n, v);
}
template <typename T, typename... Ts>
inline auto ndvec(T v, int n, Ts... ns) -> vec<decltype(ndvec(v, ns...))> {
  return ndvec(ndvec(v, ns...), n);
}
template <typename T>
inline void pr(T x) {
  std::cout << x << '\n';
}
template <typename T, typename... Ts>
inline void pr(T x, Ts... xs) {
  std::cout << x << ' ';
  pr(xs...);
}
template <typename T, typename U>
inline void prif(bool b, T t, U f) {
  if (b)
    pr(t);
  else
    pr(f);
}
struct IoSetup {
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(20);
    std::cout.setf(std::ios::fixed);
  }
} iosetup;
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
signed main() {
  int m = in() - 1, d = in() - 1;
  pr((day[m] + d + 6) / 7);
  return 0;
}
