#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int a,b,x,y;

int main() {
  INCANT;
  cin >> a >> b >> x >> y;
  if (a==b) {
    cout << x << endl;
    return 0;
  }
  int ret=INF;
  ret = min(ret, abs(b-a)*y+x);
  if (a<b) {
    ret = min(ret, (abs(b-a)*2+1)*x);
  } else {
    ret = min(ret, (abs(b-a)*2-1)*x);
  }
  
  ret = min(ret,abs(b-(a-1))*y+x); // Aa-> A_b+1 -> Bb
  cout << ret << endl;
  return 0;
}
/////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////		
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a ; i > b ; i--)
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI 3.14159265
typedef long long ll;
#define vl vector<ll> 
#define IN(inp) ll inp;cin>>inp;
#define pb push_back
#define all(a) a.begin(),a.end()
#define FR(i,a) for(auto &i:a)
#define rvl(a,n) vl a;FOR(i,0,n){IN(in); a.pb(in);}
#define what(A) cout<<#A<<" is "<<A<<endl;
ll MAX = 100000000000;
ll MOD = 998244353;
void solve()
{
	IN(a)IN(b)IN(x)IN(y);
	if (abs(a - b) == 0)
	{
		cout << x << endl;
	}
	else if (a > b)
	{
		if (a - b == 1)
		{
			cout << x << endl;
		}
		else
		{
			ll ans1 = (a - b - 1) * y + x;
			ll ans2 = x + (a - b - 1) * 2 * x;
			cout << min(ans1, ans2) << endl;
		}

	}
	else
	{
		if (b - a == 1)
		{
			cout << x + y << endl;
		}
		else
		{
			ll ans1 = (b - a) * y + x;
			ll ans2 = x + (b - a) * 2 * x;
			cout << min(ans2, ans1) << endl;
		}
	}


}
int main()
{
	fastio
		//freopen("input.txt", "rt", stdin);
		//freopen("output.txt", "wt", stdout);
		ll test = 1;
	//cin >> test;
	while (test--)
	{
		solve();
	}
}