x,y = [int(i) for i in input().split()] x2,y2 = [int(i) for i in input().split()] if x2 == y2: if abs(x) > abs(x2) and x == y: print(x+1) elif x > y: print(x) else: print(y)