#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e6;
const int N = 2e5 + 7;
const int M = 5e6 + 7;
signed main() {
  ios::sync_with_stdio(false);
  long long n, k, m, ans = 0;
  int d;
  cin >> n >> k >> m >> d;
  for (int cnt = 1; cnt <= d; cnt++) {
    long long x = n / (k * (cnt - 1) + 1);
    if (x == 0) break;
    x = min(x, m);
    long long tmp = n / x;
    if (tmp < (cnt - 1) * k + 1) continue;
    ans = max(ans, cnt * 1ll * x);
  }
  cout << ans << "\n";
  return 0;
}
