/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Final Contest

Solution to Kattis Speedrun: https://open.kattis.com/problems/kattisspeedrun
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    ll s, p, a, b;
    cin >> s >> p >> a >> b;

    ll res = 1e18;
    //Try each number of additional problems to write
    for(ll i = 0; i <= p; i++) {
        //If you write i problems, this is the cost
        ll num_solve = max(0LL, ((p + i) / 2) + 1 - s - i);
        ll tot = i * b + num_solve * a;

        //Keep the minimum time over all quantities of written problems
        res = min(res, tot);
    }

    //Display the answer
    cout << res << endl;
}