#include <bits/stdc++.h>
using namespace std;
long long n, k, m, d;
int main() {
  cin >> n >> k >> m >> d;
  long long kq = 0;
  for (int i = 0; i < d; i++) {
    long long d2 = n / ((long long)i * k + 1);
    if (d2 == 0) {
      cout << kq;
      return 0;
    }
    long long kq2 = min(d2, m);
    kq2 = (long long)kq2 * (i + 1);
    kq = max(kq, kq2);
  }
  cout << kq;
}
