#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, D, M;
  cin >> n >> m >> M >> D;
  long long Max = 0, res;
  for (int i = 1; i <= D; i++) {
    long long k = ((long long)i - 1) * m + 1;
    if (k < i && k < m) break;
    res = min(n / (((long long)i - 1) * m + 1), M);
    if (res > M) continue;
    res = res * i;
    if (Max < res) {
      Max = res;
    }
  }
  cout << Max << endl;
  return 0;
}
