M,D=map(int,input().split()) print(M+D+1 if M==4 and D==1 else M+D)