#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
const int mod = 1e9 + 7;
int main() {
  int i, j, n, k;
  int m, a, b;
  cin >> n >> m >> a >> b;
  int ans = 1 << 20;
  for (i = 0; i * m <= n; ++i) {
    ans = min(ans, i * b + a * (n - i * m));
  }
  cout << min(ans, (n + m - 1) / m * b) << endl;
  return 0;
}
