#include <queue>
#include <vector>
#include <iostream>
#include <utility>
using namespace std;
using ll = int64_t;
using pll = pair<ll,ll>;

int main() {
  ll a,b,X,Y;
  cin >> a >> b >> X >> Y;
  a--; b--;
  // 0-99: A
  // 100-199: B
  vector<vector<pll>> E(200, vector<pll>{});
  for(ll i=0; i<100; i++) {
    E[i].push_back(make_pair(100+i, X));
    E[100+i].push_back(make_pair(i, X));
  }
  for(ll i=0; i<99; i++) {
    E[i+1].push_back(make_pair(100+i, X));
    E[i+100].push_back(make_pair(1+i, X));
  }
  for(ll i=0; i<99; i++) {
    E[i].push_back(make_pair(i+1, Y));
    E[i+1].push_back(make_pair(i, Y));
    E[100+i].push_back(make_pair(101+i, Y));
    E[101+i].push_back(make_pair(100+i, Y));
  }

  vector<int> SEEN(200, false);
  priority_queue<pll,vector<pll>,greater<pll>> Q;
  Q.push(make_pair(0, a));
  while(!Q.empty()) {
    pll dx = Q.top(); Q.pop();
    ll x = dx.second;
    if(SEEN[x]) { continue; }
    SEEN[x] = true;
    if(x==100+b) {
      cout << dx.first << endl;
      return 0;
    }
    for(pll e : E[x]) {
      Q.push(make_pair(dx.first+e.second, e.first));
    }
  }
}

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	int ans = 0;
	if(a == b){
		printf("%d\n",x);
	}else if(a < b){
		ans += x;
		ans += min(2 * x, y) * (b - a);
		printf("%d\n",ans);
	}else{
		ans += x;
		ans += min(2 * x, y) * (a - b - 1);
		printf("%d\n",ans);
	}
	
	return 0;
}