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