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.
def get_total_days(month):
    if month == 2:
        return 28
    if month == 7 or month == 8:
        return 31
    if month % 2 == 0:
        if month <= 7:
            return 30
        return 31
    else:
        if month <= 7:
            return 31
        return 30


def solve(month, weekday):
    """
    How many weeks are needed?

    Month
    1 = January
    ...
    12 = December

    Weekday
    1 = Monday
    ...
    7 = Sunday

    January has 31 days.
    The number of days alternate between 31 and 30 until December.
    Two exceptions:
        1. February has 28 days(29 in a leap year)
        2. August skips alternation(July and August has 31 days)

    Algorithm
    1. Get days of the given month.
    2. Days / 7 => minimum weeks
    3. Days % 7 => remainder days
    4. Compute additional weeks => Weekday + > 8 ? 2 : 1
    """
    days = get_total_days(month)
    weeks = days // 7
    remainder_days = days % 7
    if weekday == 1 and remainder_days == 0:
        return weeks
    additional_weeks = 2 if weekday + remainder_days > 8 else 1
    return weeks + additional_weeks


def main():
    month, weekday = input().split()
    answer = solve(int(month), int(weekday))
    print(answer)
    return answer


if __name__ == '__main__':
    main()
