#include int main(){ long long A,B,N,M; scanf("%lld%lld%lld%lld",&A,&B,&N,&M); if(A>B){ printf("%lld\n",B+(A-B)/(N+1)); } else{ printf("%lld\n",A+(B-A)/(M+1)); } return 0; }