#include <bits/stdc++.h>
using namespace std;

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    int A, B, X, Y;
    cin >> A >> B >> X >> Y;
    int N = 200;
    vector<vector<pair<int, int>>> list(N);
    for (int i = 0; i < 100; i++)
    {
        list[i].push_back({i + 100, X}), list[i + 100].push_back({i, X});
        if (i != 99)
        {
            list[i + 1].push_back({i + 100, X}), list[i + 100].push_back({i + 1, X});
            list[i].push_back({i + 1, Y}), list[i + 1].push_back({i, Y});
            list[i + 100].push_back({i + 101, Y}), list[i + 101].push_back({i + 100, Y});
        }
    }

    vector<int> length(N, MOD); //始点からの距離
    queue<int> que;             //訪問予定
    int search, now;

    que.push(A - 1);
    length[A - 1] = 0;
    while (!que.empty())
    {
        int now = que.front();
        que.pop();
        for (int i = 0; i < list[now].size(); i++)
        {
            auto search = list[now][i];
            int to = search.first;      //目的地
            int Length = search.second; //距離
            if (length[to] > length[now] + Length)
            {
                length[to] = length[now] + Length;
                que.push(to);
            }
        }
    }
    cout << length[B + 99];
}
/*
   Three things which are very important --
   Violence - Speed - Momentum
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define setbits(x)      __builtin_popcountll(x)
#define leadzero(x)     __builtin_clz(x)
#define trailzero(x)    __builtin_ctz(x)
#define bitsparity(x)   __builtin_parity(x)
#define mod             1000000007
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll              long long 
#define pre(y,x)        fixed<<setprecision(y)<<x
#define dbg1(x)         cerr << "|" << #x << ": " << (x) << "|\n";
#define dbg2(x,y)       cerr << "|" << #x << ": " << (x) << "|" << #y << ": " << (y) << "|\n";
#define dbg3(x,y,z)     cerr << "|" << #x << ": " << (x) << "|" << #y << ": " << (y) << "|" << #z << ": " << (z) << "|\n";
#define ff              first
#define ss              second
#define pb              push_back
#define eb              emplace_back
#define popb            pop_back
#define endl            '\n'
#define all(v)          v.begin(), v.end()
#define sz(x)           ((int)((x).size()))
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii;
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl;
typedef vector<string> vs;
ll power(ll a, ll b) {
	if(b<0) return 1;
	ll res=1;
	while(b) {
		if(b&1) 
			res = (res*a);//%mod;
		a = (a*a);//%mod;
		b >>= 1;
	}
	return res;
}
bool ispoweroftwo(ll x){ return (x&&!(x&(x-1)));}
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
const int inf = 1e9;
int dx[] = {-1, 0, 1, 0}; 
int dy[] = {0, 1, 0, -1};
char MV[] = {'U', 'R', 'D', 'L'};
//integer to char always remember (char+'0')
const double pi = acos(-1);
const ll INF = 1e18;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
	FIO;
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	
	int diff = abs(a-b);
	
	if(diff == 0) {
		cout << x;
	}	
	else if(diff == 1) {
		if(a > b) {
			cout << x;
		} else {
			cout << min(diff*3*x-(diff-1)*x, x + diff*y);
		}
	} else {
		if(a > b) {
			cout << min(2*diff*x-x, x + (diff-1)*y);
		} else {
			cout << min(diff*3*x-(diff-1)*x, x + diff*y);
		}
	}
}
/*

*/
	
