#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const long double PI = acos(-1.0);
const long double EPS = 1e-6;
const long long INF = 1e9;
const long long LINF = 1e18;
const long long mod = 1e9 + 9;
const long long MAX = 1e5 + 47;
long long n, k, M, D;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k >> M >> D;
  long long ans = 0;
  long long cnt = 1;
  for (int i = 1; i <= D; i++) {
    long long val = n / cnt;
    if (val == 0) break;
    if (val > M) val = M;
    ans = max(ans, val * i);
    cnt += k;
  }
  cout << ans;
  return 0;
}
