m,d=map(int,input().split()) if m==4 and d==1: print(m+d+1) else:print(m+d)