#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
  int tab;
  auto geti = [&]() {
    cin >> tab;
    return tab;
  };
  ;
  long long n, k, m, d;
  cin >> n >> k >> m >> d;
  long long res = m;
  long long r;
  for (__typeof(2) c = 2; c < d + 1; c++) {
    r = min(m, n / ((c - 1) * k + 1));
    if (r > 0) {
      res = max(res, c * r);
    } else
      break;
  }
  {
    cerr << "r"
         << " = " << r << endl;
  };
  cout << res;
}
