#include "bits/stdc++.h" using namespace std; int main() { int a, b, n, m; cin >> a >> b >> n >> m; if(a >= b) cout << b + (a - b) / (n + 1) << endl; else cout << a + (b - a) / (m + 1) << endl; }