#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T>bool chmin(T& x,const T&y) {if(x>y){x=y;return true;} else return false;}
template<typename T>bool chmax(T& x,const T&y) {if(x<y){x=y;return true;} else return false;}

int main() {
    int A, B, X, Y;
    cin >> A >> B >> X >> Y;
    int ans = X + abs(A - B) * Y;
    if (A > B) {
        int temp = ((A-B) + (A-B-1)) * X;
        chmin(ans, temp);
        temp = X + abs(A - 1 - B) * Y;
        chmin(ans, temp);
    } else if (A < B) {
        int temp = ((B-A) + (B-A+1)) * X;
        chmin(ans, temp);
    }
    cout << ans << '\n';
    return 0;
    // Pとpii, 重複, 境界, ll, 0, -, 1i, for s&g, debug
}
#include<bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main(){
	ll n,k; cin>>n>>k;
	k = abs(k);
	ll ans = 0;
	for (ll i=2; i<=(2*n-k); i++){
		ans += (n - abs(i-n-1)) * (n - abs(i+k-n-1));
	}
	cout << ans << endl;
}