M, D = list(map(int, input().split(" ")))
if M+D == 5:
    print(0)
else:
    print(M+D)