#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e6 + 1;
const long long MNN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long MAGIC = 1000;
const long double EPS = 1e-9;
vector<int> v;
int n, m, a, b, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> a >> b;
  int x = min(min(a * n, (n - n % m) / m * b + n % m * a), (n + m) / m * b);
  cout << x;
  return 0;
}
