#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define abs(x)(x<0 ? -x : x)

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



#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

 
template<typename T>
vector<T> dijkstra(int s,vector<vector<pair<int,T>>> &G){
    const T TINF=numeric_limits<T>::max();
    using P=pair<T,int>;
    int n=G.size();
    vector<T> d(n,TINF);
    vector<int> b(n,-1);//previous point
    priority_queue<P,vector<P>,greater<P>> q;
    d[s]=0;
    q.emplace(d[s],s);
    while(!q.empty()){
        P p=q.top();q.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        for(auto& e:G[v]){
            int u=e.first;
            T c=e.second;
            if(d[u]>d[v]+c){
                d[u]=d[v]+c;
                b[u]=v;
                q.emplace(d[u],u);
            }
        }
    }
    return d;
}


signed main(){

    int a,b,x,y;cin>>a>>b>>x>>y;a--,b--;
    int n=100;
    vector<vector<pair<int,ll>>> g(2*n);
    rep(i,n){
        g[i].emplace_back(i+n,x);
        g[i+n].emplace_back(i,x);
        if(i+1<n){
        g[i+1].emplace_back(i+n,x);
        g[i+n].emplace_back(i+1,x);
        g[i].emplace_back(i+1,y);
        g[i+1].emplace_back(i,y);
        g[i+n].emplace_back(i+1+n,y);
        g[i+1+n].emplace_back(i+n,y);
        }
    }

    auto d=dijkstra(a,g);
    cout<<d[b+n]<<endl;
    return 0;
}
