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