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

#define co(n) cout<<n<<endl;
const double eps=1e-10,pi=3.1415926535898;
const int mod=1e9+7,maxn=2e5+10;
int T,n,m,k,x,y,a,b;

int main(int argc, char const *argv[]) {
	scanf("%d %d %d %d", &a, &b, &x, &y);
	if (y>2*x) y = 2*x;
	if (a > b) {
		if ((a-b)&1) {
			printf("%d\n", (a-b-1)*y+x);
		}
		else {
			printf("%d\n", (a-b-1)*y+x);
		}
	}
	else if (a == b) {
		printf("%d\n", x);
	}
	else {
		if ((b-a)&1) {
			printf("%d\n", (b-a)*y+x);
		}
		else {
			printf("%d\n", (b-a)*y+x);
		}
	}
	return 0;
}
#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
#define endl "\n"

struct edge {
	int v;
	long long w;
	edge() {}
	edge(int v, long long w) : v(v), w(w) {};
};

vector<long long> dijkstra(int n, vector<vector<edge> >& G, int s) {
	vector<long long> d(n, 1e18);
	d[s] = 0;
	priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> que;
	que.push(make_pair((long long)0, s));
	while (!que.empty()) {
		auto p = que.top();
		que.pop();
		int u = p.second;
		long long dist = p.first;
		if (dist > d[u]) continue;
		for (edge e : G[u]) {
			if (d[e.v] > d[u] + e.w) {
				d[e.v] = d[u] + e.w;
				que.push(make_pair(d[e.v], e.v));
			}
		}
	}
	return d;
}

int main() {
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	a--;
	b--;
	b += 100;
	vector<vector<edge>> G(200);
	for (int i = 0; i < 100; ++i) {
		G[i].emplace_back(i + 100, x);
		G[i + 100].emplace_back(i, x);
	}
	for (int i = 1; i <= 99; ++i) {
		G[i].emplace_back(i + 99, x);
		G[i + 99].emplace_back(i, x);
	}
	for (int i = 0; i < 99; ++i) {
		G[i].emplace_back(i + 1, y);
		G[i + 1].emplace_back(i, y);
		G[i + 100].emplace_back(i + 101, y);
		G[i + 101].emplace_back(i + 100, y);
	}
	auto d = dijkstra(200, G, a);
	cout << d[b] << endl;
	return 0;
}