#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
vector<vector<PII>>adj(1000);
int main()
{
	ll a,b,x,y;
	cin>>a>>b>>x>>y;
	for(int i=1;i<=100;i++){
		adj[i].pb({100+i,x});
		adj[100+i].pb({i,x});
		if(i!=1){
			adj[i].pb({100+i-1,x});
			adj[100+i-1].pb({i,x});
		}
	}
	for(int i=1;i<100;i++){
		adj[i].pb({i+1,y});
		adj[i+1].pb({i,y});
		adj[100+i].pb({100+i+1,y});
		adj[100+i+1].pb({100+i,y});
	}
	vector<ll>dist(1000,INF);
	dist[a] = 0;
	priority_queue<PII,vector<PII>,greater<PII>>pq;
	pq.push({0,a});
	while(!pq.empty()){
		int v = pq.top().se;
		int d = pq.top().fi;
		pq.pop();
		if(dist[v] != d)continue;
		for(auto z:adj[v]){
			if(dist[z.fi] >dist[v]+z.se){
				dist[z.fi] = dist[v]+z.se;
				pq.push({dist[z.fi],z.fi});
			}
		}
		
	}
	cout<<dist[b+100];
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <vector>
#include <stack>
#include <set>
//#define int long long
using namespace std;
typedef long long ll;
const int maxn=1007;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int HASH=131;


signed main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int palou=min(d,2*c);
    if(a<b)
    {
        cout<<(b-a)*palou+c<<endl;
    }
    else if(a==b) cout<<c<<endl;
    else if(a>b)
    {
        cout<<(a-b-1)*palou+c<<endl;
    }
    return 0;
}
