#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
/*coment

*/
int main () {
    using ll = long long int ; 
    using p = pair<int,int>;
    int a,b,x,y;
    cin >> a >> b >> x >> y;
    // a + 1 = b// a = b 
    int t = 0;
    if (a - 1 == b) {
        cout << x << endl;
    }
    else {
        if (a > b) {
            if (x * 2 < y) {
                cout << x * (1 + 2 * (a-b-1)) << endl;
            }
            else {
                cout << x + y * (a - b-1) << endl;
            }
        }
        else {
            if (x * 2 < y) {
                cout << x * (1 + 2 *(b-a)) << endl;
            }
            else {
                cout << x + y * (b-a) << endl;
            }

        }
    }
}
//nik
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#define reg register
#define FOR(a, b, c) for (a = b; a <=c; a++)
#define rFOR(a, b, c) for (a = b;a >= c; a--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define SORT(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define newl "\n"
#define alls(x) x.begin(), x.end(), x.begin()
#define umap(v, t1, t2) unordered_map<t1, t2> v
#define uset(v,t1) unordered_set<t1> v
#define IOF ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using UL  =  unsigned long int;
using UI  =  unsigned int;
using ULL =  unsigned long long int;
using LI  =  long int;
using LL  =  long long;
using LF  =  double;
using LLF =  long double;
const int MOD1 = 1000000007;
/*const int MOD2 = */
/* Combinatorics Start */
int binoMax = 10000;
vector<LL> numInv(binoMax + 1), factNumInv(binoMax + 1), fact(binoMax + 1);
inline void generate_ncrp(LL p)
{   int i;numInv[0] = numInv[1] = 1;
	FOR(i, 2, binoMax)
	{	numInv[i] = numInv[p % i] * (p - p / i) % p;
	}	factNumInv[0] = factNumInv[1] = 1;
	FOR(i, 2, binoMax)
	{	factNumInv[i] = (numInv[i] * factNumInv[i - 1]) % p;
	}
	fact[0] = 1;
	FOR(i, 1, binoMax)
	{	fact[i] = (fact[i - 1] * i) % p;
	}
}
LL ncrmodp(LL n, LL r, LL p)
{	LL ans = ((fact[n] * factNumInv[r]) % p * factNumInv[n - r]) % p;
	return ans;
}
/* Combinatorics End */

LL expmodp(LL x, LL y, LL p)
{	LL res = 1;
	while (y > 0)
	{	if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}return res;
}
/* Matrix Operations Start */
struct Matrix{
	int row,col;
	vector<vector<LL> > a;
	Matrix(int r,int c){
		row=r;col=c;
		a.resize(row,vector<LL>(col,0));
;	}
    static Matrix IDM(LL n){
    	Matrix res(n,n);
    	for(int i=0;i<n;i++)res.a[i][i]=1;
    	return res;
	}
};
Matrix Matmult(Matrix A,Matrix B){
	Matrix res(A.row,B.col);
	LL i,j,k;
	FOR(i,0,A.row-1){
		FOR(j,0,B.col-1){
			FOR(k,0,A.col-1){
				res.a[i][j]=(res.a[i][j]+A.a[i][k]*B.a[k][j])%MOD1;
			}
		}
	}
	return res;
	
}
Matrix BinExp(Matrix X,LL n){
	Matrix res=Matrix::IDM(X.row);
	while(n>0){
		if(n&1){
			res=Matmult(X,res);
		}
		X=Matmult(X,X);
		n>>=1;
	}
	return res;
}
/* Matrix Operations End */

int main()
{
	IOF
	LL i,j,k,n,tc,tp1,tp2,tp3;
    LL a,b,x,y;
    cin>>a>>b>>x>>y;
    if(a==b){
        cout<<x;
    }
    else if(a<b){
        int dpa[101],dpb[101];
        memset(dpa,0,sizeof(dpa));
        memset(dpb,0,sizeof(dpb));
        dpb[a]=x;
        for(i=min(a,b)+1;i<=max(a,b);i++){
            dpb[i]=min(min(x+y,3*x)+dpa[i-1],min(y,2*x)+dpb[i-1]);
            dpa[i]=min(min(2*x,y)+dpa[i-1],dpb[i-1]+x);
        }
        cout<<dpb[b];
    }
    else{
        int dpa[101],dpb[101];
        memset(dpa,0,sizeof(dpa));
        memset(dpb,0,sizeof(dpb));
        dpb[a]=x;
        for(i=max(a,b)-1;i>=min(a,b);i--){
            dpb[i]=min(dpa[i+1]+x,dpb[i+1]+min(y,2*x));
            dpa[i]=min(dpa[i+1]+min(2*x,y),dpb[i+1]+min(3*x,x+y));
        }
        cout<<dpb[b];
    }

}