#include <cstdio>
#include <queue>
#include <algorithm>

using namespace std;

int d[101][2];

int main() {
    int a, b, x, y, i, j;
    priority_queue<pair<int, pair<int, int>>> q;
    
    scanf("%d %d %d %d", &a, &b, &x, &y);
    
    for (i = 1; i <= 100; i++) {
        for (j = 0; j < 2; j++) {
            d[i][j] = 1e9;
        }
    }
    
    d[a][0] = 0;
    q.push(make_pair(0, make_pair(a, 0)));
    
    while (!q.empty()) {
        int r = -q.top().first;
        int s = q.top().second.first;
        int t = q.top().second.second;
        
        q.pop();
        
        if (d[s][t] != r) continue;
        
        if (s == b && t == 1) {
            printf("%d\n", r);
            
            return 0;
        }
        
        if (d[s][1 - t] > r + x) {
            d[s][1 - t] = r + x;
            q.push(make_pair(-d[s][1 - t], make_pair(s, 1 - t)));
        }
        
        if (t == 0 && s - 1 >= 1 && d[s - 1][1 - t] > r + x) {
            d[s - 1][1 - t] = r + x;
            q.push(make_pair(-d[s - 1][1 - t], make_pair(s - 1, 1 - t)));
        }
        
        if (t == 1 && s + 1 <= 100 && d[s + 1][1 - t] > r + x) {
            d[s + 1][1 - t] = d[s][t] + x;
            q.push(make_pair(-d[s + 1][1 - t], make_pair(s + 1, 1 - t)));
        }
        
        if (s + 1 <= 100 && d[s + 1][t] > r + y) {
            d[s + 1][t] = d[s][t] + y;
            q.push(make_pair(-d[s + 1][t], make_pair(s + 1, t)));
        }
        
        if (s - 1 >= 1 && d[s - 1][t] > r + y) {
            d[s - 1][t] = d[s][t] + y;
            q.push(make_pair(-d[s - 1][t], make_pair(s - 1, t)));
        }
    }
    
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <typename T>
vector<T> Dijkstra(int s, vector<vector<pair<int, T>>>& G,
                   /*vector<int> & prev,*/ const T INF = 1e9) {
    using P = pair<T, int>;
    int V = G.size();
    vector<T> dist(V, INF);
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0;
    que.emplace(0, s);
    // prev.assign(V, -1);
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (dist[v] < p.first) continue;
        for (int i = 0; i < (int)G[v].size(); i++) {
            int to = G[v][i].first;
            T cost = G[v][i].second;
            if (dist[to] > dist[v] + cost) {
                dist[to] = dist[v] + cost;
                // prev[to] = v;
                que.emplace(dist[to], to);
            }
        }
    }
    return dist;
}

constexpr int n = 100;

signed main() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    a--;
    b--;
    vector<vector<pair<int, int>>> G(2 * n);
    for (int i = 0; i < n; i++) {
        G[i].emplace_back(n + i, x);
        G[n + i].emplace_back(i, x);
    }
    for (int i = 0; i < n - 1; i++) {
        G[i + 1].emplace_back(n + i, x);
        G[n + i].emplace_back(i + 1, x);
        G[i].emplace_back(i + 1, y);
        G[i + 1].emplace_back(i, y);
        G[n + i].emplace_back(n + i + 1, y);
        G[n + i + 1].emplace_back(n + i, y);
    }
    auto dist = Dijkstra(a, G);
    cout << dist[b + n] << endl;
    return 0;
}