#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b, x, y;
  cin >> a >> b >> x >> y;
  const int y_ = min(y, x + x);
  a = 2 * a;
  b = 2 * b + 1;
  int d = abs(a - b);
  cout << d / 2 * y_ + d % 2 * x << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;
template <typename T> using lqueue = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using gqueue = priority_queue<T, vector<T>, less<T>>;

int main() {
    constexpr int A = 0, B = 1;

    int a, b, x, y; cin >> a >> b >> x >> y; --a; --b;
    auto edges = [=](int b, int n) -> array<array<int, 3>, 4> {
        if (b == A) {
            return {{
                { x, B, n }, { x, B, n - 1 }, { y, A, n - 1 }, { y, A, n + 1 },
            }};
        }
        else {
            return {{
                { x, A, n }, { x, A, n + 1 }, { y, B, n - 1 }, { y, B, n + 1 },
            }};
        }
    };

    array<array<int, 100>, 2> dist;
    lqueue<array<int, 3>> que;
    for (auto &e1 : dist) for (auto &e2 : e1) e2 = -1;
    que.push({ 0, A, a });

    while (!que.empty()) {
        auto [c, b, n] = que.top(); que.pop();
        if (dist[b][n] != -1) continue;
        dist[b][n] = c;

        for (auto [nc, nb, nn] : edges(b, n)) {
            if (nn < 0 || 99 < nn) continue;
            que.push({ c + nc, nb, nn });
        }
    }

    cout << dist[B][b] << endl;
}

