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

#include<bits/stdc++.h>
#include<tuple>
typedef long long ll;
#define INF 9999999999
#define mod 1000000007
using namespace std;
typedef pair<ll,ll>du;
ll dp[5][105],a,b,x,y;
int main(){
    ll i,j,k;
    ios::sync_with_stdio(0);
    cin>>a>>b>>x>>y;
    for(ll i=0;i<=100;i++)
        dp[1][i]=dp[0][i]=INF;
    dp[0][a]=0;
    for(ll i=a;i<=100;i++){
        dp[1][i]=min(dp[1][i],dp[0][i]+x);
        dp[0][i]=min(dp[0][i],dp[1][i]+x);
        dp[1][i+1]=min(dp[1][i+1],dp[1][i]+y);
        dp[0][i+1]=min(dp[0][i+1],dp[0][i]+y);
        dp[0][i+1]=min(dp[0][i+1],dp[1][i]+x);
    }
    for(ll i=a;i>=1;i--){
        dp[1][i]=min(dp[1][i],dp[0][i]+x);
        dp[0][i]=min(dp[0][i],dp[1][i]+x);
        dp[1][i-1]=min(dp[1][i-1],dp[1][i]+y);
        dp[0][i-1]=min(dp[0][i-1],dp[0][i]+y);
        dp[1][i-1]=min(dp[1][i-1],dp[0][i]+x);
    }
    cout<<dp[1][b]<<endl;
    return 0;
}