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.util.*;
import java.io.*;
import java.math.*;
public class Main {
	public static long mod= (long) (1e9 +7);
	public static void main(String args[]) throws IOException
	{
		InputReader s= new InputReader(System.in);
		OutputStream outputStream= System.out;
		PrintWriter out= new PrintWriter(outputStream);
		int m= s.nextInt();
		int d= s.nextInt();
		int x;
		if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12){
			x= d+30;
		}
		else if(m==2){
			x= d+27;
			
		}
		else{
			x= d+29;
		}
		int y= x%7==0?x/7:(x/7)+1;
		out.println(y);
		out.close();
	}
	
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	
	static long modulo(long x,long y,long p)	
	{
		 long res = 1;
		 x = x % p;  
		 
	    while (y > 0)
	    {
	        if (y%2==1)
	            res = (res*x) % p;
	 
	        y = y>>1;
	        x = (x*x) % p;  
	    }
	    return res;
	}
	
	static void catalan_numbers(int n) {
		long catalan[]= new long[n+1];
	    catalan[1] = 1;
	    for (int i = 2; i <= n; i++) {
	        for (int j = 1; j <= i - 1; j++) {
	            catalan[i] = catalan[i] + ((catalan[j]) * catalan[i - j]);
	        }
	    }
	}
	
	static HashSet<Integer> primeFactors(int n)   // O(sqrt(n))
	{
	    // Print the number of 2s that divide n
		HashSet<Integer> arr= new HashSet<>();
	    while (n%2 == 0)
	    {
	        arr.add(2);
	        n = n/2;
	    }
	 
	    // n must be odd at this point.  So we can skip one element (Note i = i +2)
	    for (int i = 3; i <= Math.sqrt(n); i = i+2)
	    {
	        // While i divides n, print i and divide n
	        while (n%i == 0)
	        {
	            arr.add(i);
	            n = n/i;
	        }
	    }
	    // This condition is to handle the case when n is a prime number
	    // greater than 2
	    if (n > 2)
	        arr.add(n);
	    
	    return arr;
	}
 
	public static long expo(long a, long b){
		if (b==0)
	        return 1;
	    if (b==1)
	        return a;
	    if (b==2)
	        return a*a;
 
	    if (b%2==0){
	            return expo(expo(a,b/2),2);
	    }
	    else{
	        return a*expo(expo(a,(b-1)/2),2);
	    }
	}
	static class Pair implements Comparable<Pair>
	{
		int f;
		int s;
		int t;
		Pair(int ii, int cc, int dd)
		{
			f=ii;
			s=cc;
			t=dd;
		}
		
		public int compareTo(Pair o) 
		{
			return Integer.compare(this.f, o.f);
		}
		
	}
	
	public static int[] sieve(int N){    // O(n*log(logn))
		int arr[]= new int[N+1];
		for(int i=2;i<=Math.sqrt(N);i++){
			if(arr[i]==0){
				for(int j= i*i;j<= N;j= j+i){
					arr[j]=1;
				}
			}
		}
		return arr;
		// All the i for which arr[i]==0 are prime numbers.
	}
	static long gcd(long a,long b){       // O(logn)
		if(b==0) return a;
		return gcd(b,a%b);
	}
	
	static final class InputReader{
        private final InputStream stream;
        private final byte[] buf=new byte[1024];
        private int curChar;
        private int Chars;
        public InputReader(InputStream stream){this.stream=stream;}
		private int read()throws IOException{
            if(curChar>=Chars){
                curChar=0;
                Chars=stream.read(buf);
                if(Chars<=0)
                    return -1;
            }
            return buf[curChar++];
        }
        public final int nextInt()throws IOException{return (int)nextLong();}
        public final long nextLong()throws IOException{
            int c=read();
            while(isSpaceChar(c)){
                c=read();
                if(c==-1) throw new IOException();
            }
            boolean negative=false;
            if(c=='-'){
                negative=true;
                c=read();
            }
            long res=0;
            do{
                if(c<'0'||c>'9')throw new InputMismatchException();
                res*=10;
                res+=(c-'0');
                c=read();
            }while(!isSpaceChar(c));
            return negative?(-res):(res);
        }
        public final int[] nextIntBrray(int size)throws IOException{
            int[] arr=new int[size];
            for(int i=0;i<size;i++)arr[i]=nextInt();
            return arr;
        }
        public final String next()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(!isSpaceChar(c));
            return res.toString();
        }
        public final String nextLine()throws IOException{
            int c=read();
            while(isSpaceChar(c))c=read();
            StringBuilder res=new StringBuilder();
            do{
                res.append((char)c);
                c=read();
            }while(c!='\n'&&c!=-1);
            return res.toString();
        }
        private boolean isSpaceChar(int c){
            return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
        }
    }
}