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