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