#include <bits/stdc++.h>
using namespace std;
unsigned long long int n, k, m, d, ans, temp, i = 2;
int main() {
  cin >> n >> k >> m >> d;
  ans = m;
  for (i = 2; i <= d; i++) {
    if ((n / (1 + ((i - 1) * k))) == 0) break;
    temp = (n / (1 + ((i - 1) * k)));
    if (temp <= m)
      temp *= i;
    else
      temp = (m * i);
    ans = max(ans, temp);
  }
  cout << ans;
}
