#No.1893 Cycle X = map(int, input().split()) X = sorted(X) if X[1] - X[0] == 4: if X[0] - 4 >= 0: ans = X[0] - 4 else: ans = X[1] + 4 else: ans = X[0] + 4 print(ans)