A, B, N, M = map(int, input().split()) if A > B: print(B + (A-B)//(N+1)) else: print(A + (B-A)//(M+1))