#include <bits/stdc++.h>
using namespace std;
long long int n, k, m, d;
int main() {
  std::ios::sync_with_stdio(false);
  long long int best = -1;
  cin >> n >> k >> m >> d;
  int x;
  long long int pre = m;
  long long int ans = 0;
  for (int cycles = 1; cycles <= d; cycles++) {
    long long int peeps = (cycles - 1) * k + 1;
    long long int eachCandy = min(m, n / peeps);
    if (eachCandy == 0) break;
    ans = max(ans, eachCandy * cycles);
  }
  cout << ans;
  return 0;
}
