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