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