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