#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <unordered_map>
using namespace std;
#define int long long
#define pii pair<long long, long long>
const double pi = acos(-1);
const int maxn = 3e5 + 5;
const int mod = 1000000007;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b,x,y;
  cin >> a >> b >> x >> y;
  y = min(y,x*2);
  if(a > b) a--;
  cout << abs(a-b) * y + x << endl;
  return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>

inline int read() {
	int x = 0, f = 1; char ch = getchar();
	while(ch > '9' || ch < '0') { if(ch == '-') f = -1; ch = getchar(); }
	do x = x * 10 + ch - 48, ch = getchar(); while(ch >= '0' && ch <= '9');
	return x * f;
}

int f[101][2];

int main() {
	int a = read(), b = read(), x = read(), y = read();
	if(b >= a) {
		f[a][1] = x;
		for(int i = a + 1;i <= b;i++) {
			f[i][0] = std::min(f[i - 1][0] + y,f[i - 1][1] + x);
			f[i][1] = std::min(f[i - 1][1] + y,f[i][0] + x);
			f[i][0] = std::min(f[i][0],f[i - 1][1] + x + y);
		}
		std::printf("%d\n",f[b][1]);
	} else {
		f[a][1] = x;
		for(int i = a - 1;i >= b;i--) {
			f[i][1] = std::min(f[i + 1][0] + x,f[i + 1][1] + y);
			f[i][0] = std::min(f[i][1] + x,f[i + 1][0] + y);
			f[i][1] = std::min(f[i][1],f[i + 1][0] + y + x);
		}
		std::printf("%d\n",f[b][1]);
	}
	return 0;
}
