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.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
 
public class Main implements Runnable {
 
    int maxn = (int)1e2+111;
    int mod = (int)1e9+7;
    int inf = (int)1e9;
    int n,m;
    int a[] = new int[maxn];
    
    void solve() throws Exception {
    	m = in.nextInt();
    	int d = in.nextInt();
    	
    	int arr [] = {31,28,31,30,31,30,31,31,30,31,30,31};
    
    	int totald = arr[m-1];
    	int cnt = 1;
    	while (totald>0) {
    		if (d>7) {
    			d = 1;
    			cnt++;
    		}
    		totald--;
    		d++;
    	}
    	out.println(cnt);
    }

    class Pair {
    	int x;
    	int y;
    	public Pair (int x, int y) {
    		this.x = x;
    		this.y = y;
    	}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + getOuterType().hashCode();
			result = prime * result + x;
			result = prime * result + y;
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (!getOuterType().equals(other.getOuterType()))
				return false;
			if (x != other.x)
				return false;
			if (y != other.y)
				return false;
			return true;
		}
		private Main getOuterType() {
			return Main.this;
		}
    	
    	
    }

	String fileInName = "input.txt";
    boolean file = false;
    boolean isAcmp = true;
 
    static Throwable throwable;
    public static void main (String [] args) throws Throwable {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        thread.run();
        if (throwable != null)
            throw throwable;
    }
 
    FastReader in;
    PrintWriter out;
 
    public void run() {
        String fileIn = "input.txt";
        String fileOut = "output.txt";
 
        try {
            if (isAcmp) {
                if (file) {
                    in = new FastReader(new BufferedReader(new FileReader(fileIn)));
                    out = new PrintWriter (fileOut);
                } else {
                    in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
                    out = new PrintWriter(System.out);
                }
            } else if (file) {
                in = new FastReader(new BufferedReader(new FileReader(fileInName+".in")));
                out = new PrintWriter (fileInName + ".out");
            } else {
                in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(System.out);
            }
 
            solve();
        } catch(Exception e) {
            throwable = e;
        } finally {
            out.close();
        }
 
    }
}
 
class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;
 
    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }
 
    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        if (!tk.hasMoreTokens()) return nextToken();
        else
            return tk.nextToken();
    }
 
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
 
    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
 
    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}