#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, m, d, D, x, mx = 0, ans;
  cin >> n >> k >> m >> D;
  for (d = 0; d < D; d++) {
    double t = (1 + 1.0 * d * k);
    if (t > n) continue;
    x = n / (long long)t;
    if (x > m) x = m;
    ans = x * (d + 1);
    mx = max(mx, ans);
  }
  cout << mx;
  return 0;
}
