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.math.*;
            import java.io.*;
            import java.text.DecimalFormat;
            import java.math.BigInteger;
            public class Main{
                //static int d=20;
                static long mod=1000000007 ;
                static HashMap<String,Double> hm=new HashMap<>(); 
                static ArrayList<ArrayList<Integer>> arr;
                static long[] dp1,dp2;
                static int[] a;
                static int[] vis,num;
                static long max;
                static int id;
                public static void main(String[] args)  throws IOException {
                    boolean online =false;
                    String fileName = "C-large-practice";
                    PrintWriter out; 
                    if (online) {
                        s.init(new FileInputStream(new File(fileName + ".in")));
                         out= new PrintWriter(new FileWriter(fileName + "out.txt"));
                    }
                     else {
                        s.init(System.in);   
                    
                        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
                    }//r,b,y,g
                    int m=s.ni();
                    int d=s.ni();
                    int[] arr=new int[]{31,28,31,30,31,30,31,31,30,31,30,31};
                    int ans=0;
                    ans++;
                    int rem=arr[m-1]-(8-d);
                    ans+=(rem/7)+((rem%7==0)?0:1);
                    out.println(ans);
                    out.close();
     
                }
                public static long gcd(long a, long b){
                        if (a == 0) return b;
                        return gcd(b % a, a);
                }
                    
                public static boolean check(long x){
                    if(x%4==0 || x%7==0 || x%11==0)
                        return true;
                    if(x<4 || x<7 || x<11)
                        return false;
                    if(x%2==0){
                        return check(x/2);
                    }
                    else
                        return check(x/2) && check((x+1)/2);
                }
                public static int angle(int x1,int x2,int x3,int y1,int y2,int y3){
                    long val=(y2-y1)*1L*(x3-x2)-(y3-y2)*1L*(x2-x1);
                    if(val<0)
                        return 1;
                    else if(val>0)
                        return -1;
                    else
                        return 0;
                }
                
                static class BIT{
                
                    int N;
                    int tree[];
                    
                    BIT(int N){
                        this.N = N;
                        tree = new int[N + 1];
                    }
                    
                    void update(int idx){
                        while(idx <= N){
                            tree[idx]++;
                            idx += (idx & -idx);
                        }
                    }
                    
                    int query(int l,int r){
                        if(l == 1)
                            return read(r);
                        else
                            return read(r) - read(l-1);
                    }
                    
                    int read(int idx){
                        int sum = 0;
                        while(idx > 0){
                            sum += tree[idx];
                            idx -= (idx & -idx);
                        }
                        return sum;
                    }
                }
                public static boolean pal(String a){
                    int i=0;
                    int j=a.length()-1;
                    while(i<j){
                        if(a.charAt(i)!=a.charAt(j)){
                            return false;
                        }
                        i++;
                        j--;
                    }
                    return true;
                        
                }
                public static long find(long n,long k){
                    if(n==2){
                        if(k==1 || k==3)
                            return 1;
                        else
                            return 2;
                    }
                    long t=pow2(2,n,mod)-1;
                    long z=(t+1)/2;
                    if(k==z)
                        return n;
                    if(k<z)
                        return find(n-1,k);
                    else
                        return find(n-1,k-z);
                }
                public static long pow2(long a,long b,long mod){
                        long ans=1;
                        while(b>0){
                            if(b%2==1)
                                ans=(a*ans)%mod;
                            a=(a*a)%mod;
                            b/=2;
                        }
                        return  ans;
                }
                public static long pow3(long a,long b){
                        long ans=1;
                        while(b>0){
                            if(b%2==1)
                                ans=(a*ans);
                            a=(a*a);
                            b/=2;
                        }
                        return  ans;
                }
     
                 static class name implements Comparable<name> {
                    long l,b,h;
                    public name(long   x,long y,long z){
                        {
                            l=x;
                            b=y;
                        }
                        
                        
                        h=z;
                    }
                    public int compareTo(name o){
                        return -(int)(l*b-o.l*o.b);
                    }
                    
                }
                public static class s {
                    static BufferedReader reader;
                    static StringTokenizer tokenizer;
                
                    /** call this method to initialize reader for InputStream */
                    static void init(InputStream input) {
                        reader = new BufferedReader(
                                    new InputStreamReader(input) );
                        tokenizer = new StringTokenizer("");
                    }   
                
                    /** get next word */
                    static String ns() throws IOException {
                        while ( ! tokenizer.hasMoreTokens() ) {
                            //TODO add check for eof if necessary
                            tokenizer = new StringTokenizer(
                                reader.readLine() );
                        }
                        return tokenizer.nextToken();
                    }
                
                    static int ni() throws IOException {
                        return Integer.parseInt( ns() );
                    }
                
                    static double nd() throws IOException {
                        return Double.parseDouble( ns() );
                    }
                    static long nl() throws IOException {
                        return Long.parseLong( ns() );
                    }
                }
            }
                    
