#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long a, b, c, d;
  cin >> a >> b >> c >> d;
  unsigned long long max1 = c;
  for (int i = 1; i <= d - 1; i++) {
    unsigned long long p = a / (b * i + 1);
    if (!p) break;
    max1 = max(max1, (i + (unsigned long long)1) * min(p, c));
  }
  cout << max1 << endl;
}
