#include "bits/stdc++.h" using namespace std; int main() { long long 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; }