#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, m, a, b;
  cin >> n >> m >> a >> b;
  long long rs = 1e6;
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= n; j++) {
      long long s = i + j * m;
      if (s >= n) {
        long long cost = a * i + b * j;
        rs = min(rs, cost);
      }
    }
  }
  cout << rs;
}
