#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, a, b;
  cin >> n >> m >> a >> b;
  if (m != 0) {
    cout << min(n * a, min(b * (n / m) + b, b * (n / m) + a * (n % m)));
  } else
    cout << n * a;
}
int main() {
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
