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