#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  int h = ceil(1.0 * n / m);
  if (b >= a * m) {
    cout << min(a * n, h * b) << endl;
  } else {
    cout << min(min(n / m, a * n / (a * m - b)) * (b - a * m) + a * n, h * b)
         << endl;
  }
  return 0;
}
