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: $\left. \begin{array}{|r|r|r|r|r|r|} \hline & {2} & {9} & {16} & {23} & {30} \\ \hline & {3} & {10} & {17} & {24} & {31} \\ \hline & {4} & {11} & {18} & {25} & {} \\ \hline & {5} & {12} & {19} & {26} & {} \\ \hline & {6} & {13} & {20} & {27} & {} \\ \hline & {7} & {14} & {21} & {28} & {} \\ \hline 1 & {8} & {15} & {22} & {29} & {} \\ \hline \end{array} \right.$ 

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.

Difficulty: interview

Starter code:

Solutions:
import sys
arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
a, b = list(map(int, input().split()))
a -= 1
b -= 1
ctr = 1
for i in range(arr[a] - 1):
    b += 1
    if (b == 7):
        b = 0
        ctr += 1
print(ctr)
            


def main():
	m, d = map(int, input().split())
	a = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
	num = a[m - 1]
	ans = 1
	num -= (8 - d)
	ans += ((num + 7 - 1) // 7)
	print(ans)

main()

m, d = map(int, input().split())
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
print(-(-(month[m - 1] + d - 1) // 7))

m, d = list(map(int, input().split()))

nd = [0,31,28,31,30,31,30,31,31,30,31,30,31][m]

nc = 0

nd = nd - (8 - d)
nc = nc + 1

while (nd > 0):
	nd = nd - 7
	nc = nc + 1

print(nc)



d = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
n, k = map(int, input().split())
print((d[n] - (7 - k + 1) + 6) // 7 + 1)

month, day = list(map(int, input().split()))
months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
fs = 7 - day + 1
counter = 1
while fs + 7 <= months[month - 1]:
    counter += 1
    fs += 7
if (fs != months[month - 1]):
    counter += 1
print(counter)

m, d = list(map(int, input().split()))
a31 = [1, 3, 5, 7, 8, 10, 12]
c = 30
if m in a31:
    c = 31
elif m == 2:
    c = 28
c -= (8 - d)
print(1 + (c + 6) // 7)


from sys import stdin
import math

days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

M, D = list(map(int, stdin.readline().split()))
M -= 1
D -= 1

print(math.ceil((days_in_month[M] + D) / 7))


m, d = list(map(int, input().split()))

days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

print(((days[m] + d - 1) + 6) // 7)


months = [0, 31,28,31,30,31,30,31,31,30,31,30,31]

from math import ceil

m, d = list(map(int, input().split()))

print(ceil((months[m] + d - 1) / 7))


m,d=map(int,input().split())
month=[31,28,31,30,31,30,31,31,30,31,30,31]
res=(d-1+month[m-1])
if res%7>0:
  print(res//7+1)
else:
  print(res//7)

import math, sys
	
def main():
	n,d = list(map(int, input().split()))
	months = [31,28,31,30,31,30,31,31,30,31,30,31]
	k = (months[n-1] - (8-d))
	ans = 1 + k//7 + int(k%7>0)
	print(ans)
		
		 
			

def __starting_point():
	main()

__starting_point()

md = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
m, d = list(map(int, input().split()))
fsl = 7 - d + 1
md[m-1] -= fsl
print(1-(-md[m-1]//7))


import math
days = [0,31,28,31,30,31,30,31,31,30,31,30,31]
m,d=map(int,input().split())
ans = math.ceil((days[m]+d-1)/7)
print(ans)

from math import ceil

M=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

temp=input().split()
m=int(temp[0])
d=int(temp[1])
t=M[m-1]+d-1
print(ceil(t/7))

import sys
#sys.stdin = open("in.txt" , "r")
#sys.stdout = open("out.txt" , "w")
from math import ceil
days = [0,31,28,31,30,31,30,31,31,30,31,30,31]

m,d = list(map(int,input().split()))
days = d - 1 + days[m] 
print(ceil(days/7))


m,d= list(map(int,input().split()))
c = [0,31,28,31,30,31,30,31,31,30,31,30,31]
num = d - 1 + c[m]
col = num // 7;
if num % 7 != 0:
    col+=1
print(col)


mm = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30, 31]
m, d = list(map(int, input().split()))
print((mm[m-1]+d-2)//7+1)


m, d = list(map(int, input().split()))
l = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

m -= 1
t = l[m]
first_col = 8 - d
t -= first_col
c = 1
while t > 0:
    t -= 7
    c += 1
print(c)



from sys import stdin, stdout
n, k = map(int, stdin.readline().split())

cnt = k - 8
if (n == 1 or n == 3 or n == 5 or n == 7 or n == 8 or n == 10 or n == 12):
    cnt += 31
elif n == 2:
    cnt += 28
else:
    cnt += 30

if cnt % 7:
    ans = 2 + cnt // 7
else:
    ans = 1 + cnt // 7
    
stdout.write(str(ans))

m, first_day = list(map(int, input().split()))
year = [31,28,31,30,31,30,31,31,30,31,30,31]
days_num = year[m-1]
left = days_num - (7 - first_day + 1)
if(left % 7 == 0):
    print(1 + left//7)
else:
    print(2 + left//7)


import sys

def main():
    m,d = map(int,sys.stdin.readline().split())
    x = [31,28,31,30,31,30,31,31,30,31,30,31]
    y = x[m-1] + d-1
    res = y/7
    if res > int(res):
        res = int(res)+1
    print(int(res))

main()

days = [
	31,
	28,
	31,
	30,
	31,
	30,
	31,
	31,
	30,
	31,
	30,
	31,
]

month, first = map(int, input().split())
first -= 1

cnt = 1
x = days[month - 1] - (7 - first)
cnt += x // 7
if x % 7 != 0:
	cnt += 1
print(cnt) 

q,w=list(map(int,input().split()))
a=[0,31,28,31,30,31,30,31,31,30,31,30,31]
ans=1
t=a[q]-(8-w)
while t>0:
    ans+=1
    t-=7
print(ans)


m, d = list(map(int, input().split()))

days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
import math
day = days[m-1]
print(math.ceil((day + d-1)/7))