#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10,mod = 1e9+7;
int a,b,x,y,f[maxn][2];
int main() {
	cin >> a >> b >> x >> y;
	f[a<b?a:b][a<b?0:1] = 0;
	f[a<b?a:b][a<b?1:0] = x;
	for(int i = min(a,b)+1; i <= max(a,b); i++){
		f[i][0] = min(f[i-1][0]+y,f[i-1][1]+x);
		f[i][1] = min(f[i][0]+x,f[i-1][1]+y);
	}
	cout << f[a<b?b:a][a<b?1:0] << endl;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
using ll = int64_t;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b,x,y;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&x);
    scanf("%d",&y);
     
    int ans;
    if(y > 2*x){
        if(a == b){
           ans = x;
        }
        else if(a < b){
            ans = x + (b-a)*2*x;
        }
        else{
            ans = x + (a-b-1)*2*x;
        }
    }
    else{
        if(a == b){
            ans = x;
        }
        else if(a < b){
            ans = x + (b-a)*y;
        }
        else{
            ans = x + (a-b-1)*y;
        }
    }
    printf("%d\n",ans);


    return 0;
}