#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
template <typename T>
inline T BigMod(T A, T B) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % 1000000007;
    A = (A * A) % 1000000007;
    B = B >> 1;
  }
  return ret;
}
template <typename T>
inline T InvMod(T A, T M = 1000000007) {
  return BigMod(A, M - 2);
}
string tostring(long long int res) {
  string curstr = "";
  while (res != 0) {
    long long int temp = (res % 10);
    curstr += ((char)temp + '0');
    res /= 10;
  }
  reverse(curstr.begin(), curstr.end());
  return curstr;
}
long long int toint(string ss) {
  long long int inss = 0;
  for (int i = 0; i < ss.size(); i++) {
    inss = (inss * 10) + ((int)(ss[i] - '0'));
  }
  return inss;
}
int main() {
  long long int n, m, k, d, ans = -2e18 + 5;
  scanf("%lld %lld %lld %lld", &n, &k, &m, &d);
  for (long long int i = 1; i <= d; i++) {
    long long int round = i;
    long long int totppl = ((round - 1) * k) + 1;
    long long int perppl = min(m, n / totppl);
    if (perppl)
      ans = max(ans, round * perppl);
    else
      break;
  }
  printf("%lld\n", ans);
  return 0;
}
