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