#include <bits/stdc++.h>
using namespace std;
const unsigned long long INF = 1e18;
const double PI = acos(-1.0);
const int maxn = 200 + 10;
unsigned long long ans = 0;
unsigned long long n, k, M, D;
int main(int argc, const char* argv[]) {
  cin >> n >> k >> M >> D;
  for (int d = 1; d <= D; d++) {
    unsigned long long x_max = min(M, n / (k * (d - 1) + 1));
    if ((k * (d - 1) + 1) > INF) break;
    ans = max(ans, x_max * d);
  }
  cout << ans << endl;
  return 0;
}
