#include <bits/stdc++.h>

#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")

#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define loop(_) for (int __ = 0; __ < (_); ++__)
#define forn(i, n) for (int i = 0; i < n; ++i)

using namespace std;
using ll = long long;
using ld = long double;

const int N = 5e5 + 7;
const ll mod = 1e9 + 7;
const ll inf = 2e18;

auto ra = [] {char *p = new char ; delete p ; return ll(p) ; };
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count() * (ra() | 1));

int n;
int a, b, x, y;
int d[N];
vector<pair<int, int>> adj[N];

void edge(int u, int v, int w)
{
        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
}

int dijkstra()
{
        priority_queue<pair<int, int>> q;
        q.push({0, a});
        fill(d, d + N, 1e9);
        d[a] = 0;
        while (q.size())
        {
                pair<int, int> t = q.top();
                q.pop();
                for (auto u : adj[t.second])
                {
                        if ( u.second - t.first < d[u.first])
                        {
                                d[u.first] = u.second - t.first;
                                q.push({-d[u.first], u.first});
                        }
                }
        }
        return d[b + 100];
}

int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        //freopen("in.in", "r", stdin);
        cin >> a >> b >> x >> y;
        for (int i = 1; i <= 100; ++i)
        {
                edge(i, i + 100, x);
                if (i < 100)
                {
                        edge(i, i + 1, y);
                        edge(i + 100, i + 101, y);
                        edge(i + 100, i + 1, x);
                }
        }
        cout << dijkstra();
        return 0;
}

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long a,b,x,y,ans;
  cin>>a>>b>>x>>y;
  ans=0;
  if(a-b==1 || a==b){
    ans=x;
  }
  else if(a>b){
    ans=x+min(y,2*x)*(abs(a-b)-1);
  }
  else{
    ans=x+min(y,2*x)*(abs(a-b));
  }
  cout<<ans;
}