#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, t, u;
  cin >> n >> m >> a >> b;
  if (a <= (float(b) / float(m))) {
    cout << n * a;
  } else {
    t = ceil(float(n) / float(m)) * b;
    u = n / m * b + n % m * a;
    cout << min(t, u);
  }
}
