#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 7;
const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
const int INFI = 0x3f3f3f3f;
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  long long n, k, D, M, ans, divide;
  cin >> n >> k >> M >> D;
  ans = min(n, M);
  if (n == k) {
    cout << ans << endl;
    exit(0);
  }
  for (int i = 2; i <= D; i++) {
    divide = n / (k * (i - 1) + 1);
    if (!divide) break;
    divide = min(divide, M);
    ans = max(ans, divide * i);
  }
  cout << ans << endl;
}
