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