#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

using vint = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define x first
#define y second
#define all(v) (v).begin(),(v).end()

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int a, b, x, y;
  cin >> a >> b >> x >> y;
  
  int ans = 0;
  if(2 * x <= y) {
    if(a <= b) ans = (2 * (b - a) + 1) * x;
    else ans = (2 * (a - b) - 1) * x;
  }
  else {
    if(a <= b) ans = x + (b - a) * y;
    else ans = x + (a - b - 1) * y;
  }

  cout << ans << '\n';
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SIZE(x) ll(x.size())
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
typedef pair<int, int> P;
struct edge {
    ll to, cost;
};

vector<vector<edge>> G(300);

vector<ll> dijkstra(ll s, ll N)
{
    vector<ll> value(N, INF);
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, s));
    value[s] = 0;
    while (!que.empty())
    {
        P p = que.top();
        que.pop();
        ll v = p.second;
        if (value[v] < p.first)
        {
            continue;
        }
        rep(i, G[v].size())
        {
            edge e = G[v][i];
            if (value[e.to] > value[v] + e.cost)
            {
                value[e.to] = value[v] + e.cost;
                que.push(P(value[e.to], e.to));
            }
        }
    }

    return value;
}

int main()
{
    int a, b, x, y;
    cin >> a >> b >> x >> y;

    rep(i, 100) {
        G[i].push_back({i + 100, x});
        G[i + 100].push_back({i, x});
        if (i != 99) {
            G[i].push_back({i + 1, y});
            G[i + 1].push_back({i, y});
        }
        if (i != 0) {
            G[i].push_back({i + 99, x});
            G[i + 99].push_back({i, x});
        }
    }

    auto res = dijkstra(a - 1, 200);

    cout << res[b + 99] << endl;
    return 0;
}