#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long double n, k, m, d, x, ans = 0;
  cin >> n >> k >> m >> d;
  for (long double i = 1; i <= d; ++i) {
    x = min(m, floor(n / (k * (i - 1) + 1)));
    if (x == 0) break;
    ans = max(ans, i * x);
  }
  cout << (int64_t)ans;
}
