#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, m, d, one, res = 0;
  cin >> n >> k >> m >> d;
  long long time = 1;
  while (one != 0 && time <= d) {
    one = n / (time + (k - 1) * (time - 1));
    if (one > m) one = m;
    res = max(res, time * one);
    time++;
  }
  cout << res << endl;
}
