#include<bits/stdc++.h>
using namespace std;
int main(){int a,b,x,y;cin>>a>>b>>x>>y;if(a>b)a--;
           int p=min(2*x,y);p*=abs(a-b);p+=x;cout<<p<<endl;}
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx")
#pragma GCC target ("avx2,fma")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <atcoder/all>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
#define rank fewfewf
#define double long double

using namespace std;
using namespace __gnu_pbds;
//using namespace atcoder;


typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1050;
const int K = 90;
const int mod = 1e9 + 7;
vector<pair<int,int>> g[N];
int d[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    int n = 100;
    for (int i = 0; i < n - 1; i++){
        g[i].pb({i + 1, y});
        g[i + 1].pb({i, y});
        g[i + n].pb({i + n + 1, y});
        g[i + n + 1].pb({i + n, y});
        g[i + 1].pb({i + n, x});
        g[i + n].pb({i + 1, x});
    }
    for (int i = 0; i < n; i++){
        g[i].pb({i + n, x});
        g[i + n].pb({i, x});
    }
    a--;
    b--;
    b += n;
    for (int i = 0; i < n + n; i++) d[i] = 1e9;
    set<pair<int,int>> s;
    s.insert({0, a});
    d[a] = 0;
    while(!s.empty()){
        int v = (*s.begin()).S;
        s.erase(s.begin());
        for (auto e: g[v]){
            if (d[e.F] > d[v] + e.S){
                s.erase({d[e.F], e.F});
                d[e.F] = d[v] + e.S;
                s.insert({d[e.F], e.F});
            }
        }
    }
    cout << d[b];
}
