#include <bits/stdc++.h>
using namespace std;
void run() {}
int fixMod(int a, int b) { return ((a % b) + b) % b; }
void fast() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long n, k, d, m;
int chk(long long x, int i) {
  long long cur = n - (n % x);
  long long tot = n / x;
  if (ceil(tot / double(k)) == i) return 1;
  if (ceil(tot / double(k)) > i) return -1;
  return 0;
}
int main() {
  fast();
  run();
  cin >> n >> k >> m >> d;
  long long ans = -1;
  for (int i = 1; i <= d; i++) {
    long long st = 1, en = m, mid;
    while (st <= en) {
      mid = (st + en) / 2;
      int cur = chk(mid, i);
      if (cur == 1) {
        ans = max(ans, i * mid);
        st = mid + 1;
      } else if (cur == -1)
        st = mid + 1;
      else
        en = mid - 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
