#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int a, b, x, y;
    cin >> a >> b >> x >> y;

    if (a == b) cout << x << endl;
    else if (a < b) {
        if (2*x < y) cout << (b - a) * 2*x + x << endl;
        else cout << (b - a) * y + x << endl;
    }
    else {
        if (2*x < y) cout << (a - b) * 2*x - x << endl;
        else cout << (a - b - 1) * y + x << endl;
    }
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
const ll inf = 1e18;

/*-------ここから--------*/
using _ll = long long;
using _pl = pair<_ll, _ll>;
void dijkstra(vector<vector<_pl>> &G, vector<_ll> &dist, _ll initial_pos) {
    priority_queue<_pl, vector<_pl>, greater<_pl>> que;
    dist[initial_pos] = 0;
    que.push({0, initial_pos});
    while(!que.empty()) {
        auto q = que.top();
        que.pop();
        auto cur_cost = q.first;
        auto cur_pos = q.second;
        for(auto e : G[cur_pos]) {
            auto next_pos = e.first;
            auto next_cost = cur_cost + e.second;
            if(next_cost >= dist[next_pos]) continue;
            dist[next_pos] = next_cost;
            que.push({next_cost, next_pos});
        }
    }
}
/*-------ここまで--------*/


ll idx(ll a, ll b) {
    return 100*a + b;
}

void solve() {
    ll a, b, x, y;
    cin >> a >> b >> x >> y;
    a--; b--;
    vector<vector<pair<ll,ll>>> G(200);
    rep(i, 0, 100) {
        G[idx(0, i)].push_back({idx(1, i), x});
        G[idx(1, i)].push_back({idx(0, i), x});
    } 
    rep(i, 0, 99) {
        G[idx(0, i+1)].push_back({idx(1, i), x});
        G[idx(1, i)].push_back({idx(0, i+1), x});
    }
    rep(i, 0, 99) {
        G[idx(0, i)].push_back({idx(0, i+1), y});
        G[idx(0, i+1)].push_back({idx(0, i), y});
    }
    rep(i, 0, 99) {
        G[idx(1, i)].push_back({idx(1, i+1), y});
        G[idx(1, i+1)].push_back({idx(1, i), y});
    }
    vector<ll> dist(200, 1e18);
    dijkstra(G, dist, idx(0, a));
    cout << dist[idx(1, b)] << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
