#include <bits/stdc++.h>
using namespace std;
long long n, k, M, D, result;
int main() {
  scanf("%I64d%I64d%I64d%I64d", &n, &k, &M, &D);
  for (long long i = 1; i <= D; i++) {
    long long p = (i - 1) * k + 1;
    if (p > n) break;
    long long per = n / p;
    long long take = min(per, M);
    result = max(result, take * i);
  }
  printf("%I64d\n", result);
}
