#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q;q=1;
    while(q--)
    {
       int a,b,x,y;cin>>a>>b>>x>>y;
       if(a>=b)
       {
           if(a==b)
           cout<<x;
           else
           {
               if(2*x>=y)
               cout<<x+(a-b-1)*y;
               else
               cout<<(a-b)*2*x-x;
           }
       }
       else
       {
               if(2*x>=y)
               cout<<x+(b-a)*y;
               else
               cout<<(b-a)*2*x+x;
           
       }
    }
     
}
    
          

#include <bits/stdc++.h>

using namespace std;

#define PI 3.14159265358979323846264338327950L

int A = 0, B = 1;
int a, b, x, y;
vector<vector<int >> dp;
queue<pair<int, int>> que;


int solver(int ab, int floor) {
	if (dp[ab][floor] > 0) {
		return dp[ab][floor];
	}

	if (floor < a) {
		return 0;
	}

	int ret;
	if (ab == A) {
		ret = min(solver(A, floor - 1) + y, min(solver(B, floor) + x, solver(B, floor) + x));
	}
	else {
		ret = min(solver(A, floor) + x, solver(B, floor) + y);
	}

	return dp[ab][floor] = ret;

}



int main(void) {

	int start = A, end = B;

	cin >> a >> b >> x >> y;

	int tmp = a;
	a = a - tmp;
	b = b - tmp;


	if (a > b) {
		int tmp = a - b;
		a = 1;
		b = tmp + 1;
		start = B; 
		end = A;


	}

	vector<int> tmpvec1(b + 3, INT_MAX);
	vector<vector<int>> tmpDp(2, tmpvec1);
	dp = tmpDp;


	dp[start][a] = 0;
	dp[end][a] = x;





	pair<int, int> tmpP = make_pair(A, a);
	que.push(tmpP);


    for(int i=a;i<=b;i++){
        int floor=i;

        dp[A][floor + 1] = min(dp[A][floor + 1], dp[A][floor] + y);
        dp[B][floor] = min(dp[B][floor], dp[A][floor] + x);

        dp[B][floor + 1] = min(dp[B][floor + 1], dp[B][floor] + y);
        dp[A][floor + 1] = min(dp[A][floor + 1], dp[B][floor] + x);
    }



	cout << dp[end][b] << endl;







	return 0;
}

