#include <bits/stdc++.h>
using namespace std;
long long int n, k, M, D;
long long int chm_iter(long long int x) {
  if (x == 0) return 1;
  long long int num = n / (x * k);
  if (x * k * num + x == n) num++;
  return num;
}
long long int max_x(long long int chm) {
  long long int start = 0;
  long long int end = M;
  while (end - start > 1) {
    long long int mid = (start + end) / 2;
    long long int my = chm_iter(mid);
    if (my >= chm) {
      start = mid;
    } else {
      end = mid;
    }
  }
  if (chm_iter(end) == chm) return end;
  return start;
}
int main() {
  cin >> n >> k >> M >> D;
  long long int max_ans = 0;
  for (long long int i = 1; i <= D; ++i) {
    long long int num = (i - 1) * k + 1;
    if (num > n) break;
    long long int x = n / num;
    x = min(x, M);
    max_ans = max(max_ans, x * i);
  }
  cout << max_ans << endl;
  return 0;
}
