#include <bits/stdc++.h>
using namespace std;
char CRTBUFF[30000];
struct debugger {
  static void call(const char* it) {}
  template <typename T, typename... aT>
  static void call(const char* it, T a, aT... rest) {
    string b;
    for (; *it && *it != ','; ++it)
      if (*it != ' ') b += *it;
    cerr << b << "=" << a << " ";
    call(++it, rest...);
  }
};
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  };
  long long n, k, m, d, ans = 0, p, x;
  cin >> n >> k >> m >> d;
  for (int i = (0); i < (d); i += (1)) {
    if (i > (n - 1) / k) continue;
    long long p = i * k + 1, x = min(m, n / p);
    ans = max(ans, x * (i + 1));
  }
  cout << ans << endl;
}
