#include <bits/stdc++.h>
int main() {
  int n, a, b, m, tk, i, j;
  scanf("%d %d %d %d", &n, &m, &a, &b);
  if (n % m == 0) {
    tk = n * b / m;
  } else {
    i = (n - (n % m)) * b / m + (n % m) * a;
    j = (n - (n % m)) * b / m + b;
    if (i <= j)
      tk = i;
    else
      tk = j;
  }
  if (m * a < b) tk = n * a;
  printf("%d\n", tk);
  return 0;
}
