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.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
 
public class M
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		
		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}
		
		public int read()
		{
			if (numChars==-1) 
				throw new InputMismatchException();
			
			if (curChar >= numChars)
			{
				curChar = 0;
				try 
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				
				if(numChars <= 0)				
					return -1;
			}
			return buf[curChar++];
		}
	 
		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();
			
			while(isSpaceChar(c)) 
				c = read();
			
			int sgn = 1;
			
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			
			int res = 0;
			do 
			{
				if(c<'0'||c>'9') 
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c)); 
			
			return res * sgn;
		}
		
		public long nextLong() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				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 res * sgn;
		}
		
		public double nextDouble() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') 
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') 
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) 
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		
		public String readString() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do 
			{
				res.appendCodePoint(c);
				c = read();
			} 
			while (!isSpaceChar(c));
			
			return res.toString();
		}
	 
		public boolean isSpaceChar(int c) 
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	 
		public String next() 
		{
			return readString();
		}
		
		public interface SpaceCharFilter 
		{
			public boolean isSpaceChar(int ch);
		}
	}
 
	static class Node implements Comparable<Node>
	{
		int v;
		int w;
		
		Node(int v,int w)
		{
			this.v=v;
			this.w=w;
		}
		
		public int compareTo(Node node)
		{
			if(w==node.w)
				return Integer.compare(v,node.v);
			
			return (-1)*Integer.compare(w,node.w);
		}
	}
	
	static int root(int arr[],int x)
	{
		while(arr[x] != x)
		{
			arr[x] = arr[arr[x]];
			x = arr[x];
		}
		return x;
	}
	
	static void union(int arr[],int size[],int x,int y)
	{
		int root_x = root(arr,x);
		int root_y = root(arr,y);
		
		if(root_x != root_y)
		{
			if(size[root_x] > size[root_y])
			{
				arr[root_y] = arr[root_x];
				size[root_x] += size[root_y];
			}
			else
			{
				arr[root_x] = arr[root_y];
				size[root_y] += size[root_x];
			}
		}
		//arr[root_x]=root_y;
	}
	
	public static int powerSum[] = new int[1000001];
	public static boolean prime[] = new boolean[1000001];

	public static void seive()
	{
		powerSum[0] = 0;
		powerSum[1] = 1;
		
		Arrays.fill(prime , true);
		
		prime[0] = false;
		prime[1] = false;
		
		for(int i = 2 ; i <= 1000000 ; i++)
		{
			if(prime[i])
			{
				for(int j = i ; j <= 1000000 ; j += i)
				{
					int tempJ = j;
					
					while(tempJ != 0 && tempJ%i == 0)
					{
						powerSum[j]++;
						
						tempJ /= i;
					}
					
					prime[j] = false;
				}
			}
		}
	}
	
	/*
	Random rand = new Random();	
	for (int i = 0 ; i < n ; i++) 
	{
		int a = rand.nextInt(n);
		int b = rand.nextInt(n);

		int temp = arr[a];
		arr[a] = arr[b];
		arr[b] = temp;
	}
	*/
	
	public static void main(String args[]) throws Exception
	{
		InputReader In = new InputReader(System.in);		
		PrintWriter w = new PrintWriter(System.out);

		int m = In.nextInt();
		int d = In.nextInt();
		
		int month[] = {31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31};
		
		int days = month[m-1] , ans = 1;
		
		days -= (7 - d + 1);
		
		ans += (days+6)/7;
		
		w.println(ans);
		
		w.close();	
	}
}