#include <bits/stdc++.h>
using namespace std;
long long int n, k, m, d, ans;
int main() {
  cin >> n >> k >> m >> d;
  for (int i = 1; i <= d && k * (i - 1) + 1 <= n; i++)
    ans = max(ans, i * min(m, n / (k * (i - 1) + 1)));
  cout << ans << endl;
}
