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