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

int main() {
	int a, b, x, y;
	scanf("%d%d%d%d", &a, &b, &x, &y);
	if(a == b)
		printf("%d", x);
	else if(b > a) {
		int diff = b - a;
		printf("%d", min(x + diff* y, x + 2 * x * diff));
	}
	else {
		int diff = a - b - 1;
		printf("%d", min(x + diff * y, x + 2 * x * diff));
	}
}
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int a, b, x, y; cin >> a >> b >> x >> y;
	int ans = 0;
	int dp[105][2];
	memset(dp, -1, sizeof dp);
	function<int(int, int)> solve = [&] (int pos, int cur) {
		if(pos == b and cur) return 0LL;
		else if(pos == b and !cur) return x;
		int &ans = dp[pos][cur];
		if(ans != -1) return ans;
		if(pos > b) {
			if(cur)
				ans = min({solve(pos - 1, cur) + min(y, 2 * x), solve(pos - 1, cur ^ 1) + x + y});
			else
				ans = min(solve(pos - 1, cur) + y, solve(pos - 1, cur ^ 1) + x);
		}
		else if(pos < b) {
			if(cur)
				ans = min({solve(pos + 1, cur) + min(y, 2 * x), solve(pos + 1, cur ^ 1) + x});
			else 
				ans = min({solve(pos + 1, cur) + min(y, 2 * x), solve(pos + 1, cur ^ 1) + min(3 * x, x + y)});
		}
		return ans;
	};
	cout << solve(a, 0) << endl;

	return 0;
}