#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  int sum{n * a};
  for (int i{}; i <= (n / m) + 1; i++)
    sum = min({sum, (i * b) + max({0, (n - i * m)}) * a});
  cout << sum << endl;
  ;
  return 0;
}
