#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr long long INF = 1e9+100;
constexpr long long LINF = 1e18+100;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,x,y;
    while(cin>>a>>b>>x>>y)
    {
        long long ans1,ans2;
        if(a==b)
           cout<<x<<endl;
        else if(a>b)
        {
            ans1=(a-b-1)*y+x;
            ans2=(a-b-1)*2*x+x;
            cout<<min(ans1,ans2)<<endl;
        }
        else
        {
            ans1=x+(b-a)*y;
            ans2=(b-a)*2*x+x;
            cout<<min(ans1,ans2)<<endl;
        }
    }
}
