#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  float f = (float)b / m;
  if (f < a) {
    int c = n / m;
    cout << min(c * b + (n - c * m) * a, b * (c + 1));
  } else
    cout << n * a;
}
