#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;

int main() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    int t;
    t =min(2 * x, y);
    int t1;
    a = 2 * a;
    b = 2 * b + 1;
    t1 = abs(a - b);
    cout << t1 / 2 * t + t1 % 2 * x << endl;
}
#include<bits/stdc++.h>

using namespace std;

#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())

typedef long long ll;typedef vector<int> vi;
typedef pair<int,int> ii;typedef vector<ii> vii;
typedef vector<vi> vvi;

const int N = 220;
vi adj[N];
vi adw[N];
int dis[N],vis[N];

void add(int a,int b,int w){
	adj[a].pb(b);adw[a].pb(w);
	adj[b].pb(a);adw[b].pb(w);
}

signed main(){
	IOS
	int a,b,x,y;cin>>a>>b>>x>>y;
	a--;b--;
	forn(i,N) dis[i]=INT_MAX;
	for(int i=0;i<100;i++){
		add(i,i+100,x);
		if(i){
			add(i,i-1,y);
			add(i+100,i-1+100,y);
			add(i,i-1+100,x);
		}
	}
	priority_queue<ii,vii,greater<ii>> pq;
	dis[a]=0;
	pq.push({0,a});
	while(!pq.empty()){
		ii u = pq.top();pq.pop();
		if(vis[u.y]) continue;
		dis[u.y]=u.x;vis[u.y]=1;
		forn(i,sz(adj[u.y])){
			int v = adj[u.y][i];
			int w = adw[u.y][i];
			if(vis[v]) continue;
			pq.push({u.x+w,v});
		}
	}
	cout<<dis[b+100]<<"\n";
}