#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define rreps(i, n, s) for (int i = s; i >= n; i--)

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    int res = 0;
    int u = 2 * x < y ? 2 * x : y;
    if (a > b) {
        res += u * (a - b - 1) + x;
    } else {
        res += u * (b - a) + x;
    }
    cout << res << endl;
    return 0;
}
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;

#define fr first
#define sc second
#define pb push_back

int a, b, x, y, ans;

int main(){
    
    cin>>a>>b>>x>>y;
    
    if(a < b){
        ans = min((b-a)*y,(b-a)*2*x) + x;
    }
    else if(a > b){
        ans = min((a-b-1)*y,(a-b-1)*2*x) + x;
    }
    else{
        ans = x;
    }
    cout<<ans<<endl;
    
    return 0;
}
            