#include <bits/stdc++.h>
using namespace std;
const int maxN = 105;
long long n, k, M, D;
void ReadInput() { cin >> n >> k >> M >> D; }
void Solve() {
  long long ans = 0;
  for (long long i = 1; i <= D; i++) {
    if (n / k < i - 1) continue;
    long long x = n / (k * (i - 1) + 1);
    x = min(x, M);
    if (x == 0) continue;
    long long d = (n / x + k - 1) / k;
    if (d == i) ans = max(ans, x * i);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ReadInput();
  Solve();
}
