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.
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        String[] split = scanner.nextLine().split(" ");

        int mothnumb = Integer.parseInt(split[0]);
        int daynumb = Integer.parseInt(split[1]);

        int totalDays = daynumb;

        if (Arrays.asList(1, 3, 5, 7, 8, 10, 12).contains(mothnumb)) {
            totalDays += 31;
        }
        if (Arrays.asList(4, 6, 9, 11).contains(mothnumb)) {
            totalDays += 30;
        }
        if (Collections.singletonList(2).contains(mothnumb)) {
            totalDays += 28;
        }

        totalDays--;

        if ((totalDays / 7) * 7 == totalDays) {
            System.out.println(totalDays / 7);
        }

        else {
            System.out.println(totalDays / 7 +1);
        };

    }
}
