#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 69, base = 1024 * 1024, mod = 1e9 + 7;
long long n, k, m, d, wynik;
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> m >> d;
  for (long long a = 1; a <= d; a++) {
    long long l = n, p = n;
    if (a * k - k + 1 > n) {
      break;
    }
    p /= (a * k - k + 1);
    l /= (a * k);
    if (p > m) p = m;
    if (p < l) continue;
    wynik = max(wynik, p * a);
  }
  cout << wynik << "\n";
}
