#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
const ll ll_inf = ll(1e9) * ll(1e9);
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define M 1000000007

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<ll> r;

    UnionFind(ll N) {
        r = vector<ll>(N, -1);
    }

    ll root(ll x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    ll size(ll x) {
        return -r[root(x)];
    }
};

ll coin[101][101][101] = {0};

int main() {

    ll a, b, x, y, d, s;
    cin >> a >> b >> x >> y;

    if (a > b) {
        d = a - b;
        if (2 * x < y) {
            s = (2 * x*d) - x;
        }
        else {
            s = (d - 1)*y + x;
        }
    }
    else {
        d = b - a;
        if (2 * x < y) {
            s = (2 * x*d) + x;
        }
        else {
            s = d * y + x;
        }
    }

    cout << s;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int a,b,x,y;
    cin>>a>>b>>x>>y;
    int ans = x;
    if(a>b)
    {
        for(int i=b; i<a-1; i++) ans+=min(2*x,y);
    }
    else
    {
        for(int i=a; i<b; i++) ans+=min(2*x,y);
    }
    cout<<ans<<endl;
	return 0;
}
