#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
char ch[110][110];
int main() {
  long long n, k, m, d;
  cin >> n >> k >> m >> d;
  if (d == 1)
    cout << m << endl;
  else {
    long long cnt = 0;
    for (long long i = 1; i <= d; i++) {
      long long num = n / (k * (i - 1) + 1);
      if (num == 0) break;
      if (num > m) num = m;
      cnt = max(cnt, num * i);
    }
    cout << cnt << endl;
  }
  return 0;
}
