#include <bits/stdc++.h>
using namespace std;
int acum[105][105];
char grilla[105][105];
int main() {
  long long n, M, D, k;
  cin >> n >> k >> M >> D;
  long long e = (n + k - 1) / k;
  long long maxi = 0;
  for (long long i = 1; i <= min(D, e); i++) {
    long long supe = (i - 1) * k + 1;
    long long infe = (i)*k + 1;
    supe = n / supe;
    bool flag = 0;
    if (n % infe == 0) flag = 1;
    infe = n / infe;
    infe++;
    long long x = min(supe, M);
    if (x < infe) continue;
    maxi = max(maxi, x * i);
  }
  cout << maxi << "\n";
  return 0;
}
