#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long cs = 200005;
const long long mod = 1000000007;
const double PI = 2 * acos(0.0);
void solve() {
  long long int t, n, m, a, b, c, d, e, i, j, k, x, y, z, cnt = 0, cnt1 = 0;
  bool flag = false;
  cin >> n >> m >> x >> y;
  cnt = x;
  for (i = 1; i <= y; i++) {
    a = n / (m * i - m + 1);
    if (!a) break;
    if (a > x) a = x;
    if (cnt < a * i) cnt = a * i;
  }
  cout << cnt << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
