#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans = 0;
void Main(){
    using P = pair<int, int>;
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    a--;
    b--;
    vector<vector<P>> graph(200);
    For(i,0,100){
        graph[i].push_back({i + 100, x});
        graph[i + 100].push_back({i , x});
    }
    For(i,0,99){
        graph[i + 1].push_back({i + 100, x});
        graph[i + 100].push_back({i + 1 , x});
    }
    For(i,0,99){
        graph[i].push_back({i + 1, y});
        graph[i + 1].push_back({i, y});
        graph[i + 100].push_back({i + 101, y});
        graph[i + 101].push_back({i + 100, y});
    }
    vector<int> dist(200, 1e9);
    dist[a] = 0;
    stack<P> st;
    st.push({a , 0});
    while(!st.empty()){
        auto [now, d] = st.top();
        st.pop();
        for(auto to : graph[now]){
            if(dist[to.first] > d + to.second){
                dist[to.first] = d + to.second;
                st.push({to.first, dist[to.first]});
            }
        }
    }
    cout << dist[b + 100] << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}
#include<iostream>
#include<bits/stdc++.h>
#define int long long int 
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    int a,b,x,y;
    cin>>a>>b>>x>>y;

    int dist = abs(a-b);
    int cost1 = dist*y +x,cost2,cost3;
    if(a<=b)
    cost2 = 2*dist*x + x;
    else
    {
    cost2 = 2*dist*x -x;
    cost3 = x +y*(dist-1);
    cost2 = min(cost2,cost3);
    }
    
    cout<<min(cost1,cost2);


    return 0;
}