#include <bits/stdc++.h>
int main() {
  float n, m, a, b;
  scanf("%f%f%f%f", &n, &m, &a, &b);
  int x = n / m;
  if ((b / m) <= a && (x)*b + (n - x * m) * a <= (x + 1) * (b))
    printf("%.0f", (x)*b + (n - x * m) * a);
  else if ((b / m) <= a && (x)*b + (n - x * m) * a > (x + 1) * (b))
    printf("%.0f", (x + 1) * b);
  else
    printf("%.0f", n * a);
  return 0;
}
