#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long int m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
const long long int mod = 1000000007;
const long long int N = 3e5, M = N;
vector<int> g[N];
long long int a[N];
long long int mpow(long long int base, long long int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long int)result * base) % mod;
    base = ((long long int)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
void ipgraph(long long int n, long long int m) {
  long long int i, u, v;
  while (m--) {
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
int sgn(long long int n) {
  if (n > 0) {
    return 1;
  } else {
    return -1;
  }
}
long long int max_digit(long long int n) {
  long long int lar = 0;
  while (n) {
    long long int r = n % 10;
    lar = max(r, lar);
    n = n / 10;
  }
  return lar;
}
long long int min_digit(long long int n) {
  long long int lar = 9;
  while (n) {
    long long int r = n % 10;
    lar = min(r, lar);
    n = n / 10;
  }
  return lar;
}
int prime(long long int n) {
  for (long long int i = 2; i < n; i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
void dfs(long long int u, long long int par) {
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
  }
}
int per(long long int n) {
  if ((long long int)sqrt(n) == (double)sqrt(n)) {
    return 1;
  }
  return 0;
}
int vowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    return 1;
  }
  return 0;
}
long long int th(long long int n) {
  long long int c = 0;
  while (n % 3 == 0) {
    c++;
    n = n / 3;
  }
  return c;
}
int solve() {
  long long int n, m, a, b, nn;
  cin >> n >> m >> a >> b;
  if (b <= m * a) {
    if (n <= m) {
      cout << min(n * a, b);
      return 0;
    }
    long long int rem = n % m;
    long long int sum = n / m;
    cout << min(n * a, sum * b + min(rem * a, b));
  } else
    cout << a * n;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(10);
  int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
