#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b,x,y;
	cin>>a>>b>>x>>y;
	if(a==b)
	{
		cout<<x<<"\n";
	}
	else if(a<b)
	{
		int d=b-a;
		int ans=min(d*y+x,d*2*x+x);
		cout<<ans<<"\n";
	}
	else
	{
		int d=a-b;
		int ans=min({(d*y)+x,(d-1)*2*x+x,(d-1)*y+x});
		cout<<ans<<"\n";
	}
}

#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define mem(a,b)   memset(a,b,sizeof(a))
#define en         cout<<endl;
#define pb         push_back
#define gcd(n,m)   __gcd(n,m)
#define lcm(n,m)   ((n)/__gcd(n,m))*(m)
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define all(x)     (x).begin(),(x).end()
#define allr(x)    (x).rbegin(),(x).rend()
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long
#define PI         2*acos(0.0)
#define MAXN       3*100000
ll n,m,k,g,mx,mn,res,c,x,y,z,w,p,q,r,l,s,t;

void solve()
{
    ll a,b;
    ci>>a>>b>>x>>y;
    if(a<b)
    {
        res=(((b-a)*2)+1)*x;
        res=min(res,x+(y*(b-a)));
        co<<res<<endl;
    }
    else if(a>b)
    {
        res=(((a-b)*2)-1)*x;
        res=min(res,x+(y*(a-b)));
        if(a-b>1) res=min(res,x+(y*(a-b-1)));
        co<<res<<endl;
    }
    else
    {
        co<<x<<endl;
    }
    

}

int main()
{
        
//#ifdef LOCAL
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        auto start_time = clock();
        cerr << setprecision(3) << fixed;
//#endif
        cout << setprecision(10) << fixed;
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        //ci>>t;
        t=1;
        for(ll ca=0;ca<t;ca++)
        {
            solve();
        }
//#ifdef LOCAL
        auto end_time = clock();
        cerr<< "Execution time: "<<(end_time-start_time)*(int)1e3/CLOCKS_PER_SEC<<" ms\n";
//#endif
}