#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define drep(i,b,a) for(int i = (b)-1; i >= (a); i--)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(v) sort(v.begin(),v.end());
#define RSORT(v) sort(v.rbegin(),v.rend());
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vd> vvd;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
const int inf = 1 << 30; const ll infl = 1LL << 60; const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool  odd(T x) { return x & 1; }
template<class T> inline bool even(T x) { return !(x & 1); }
template<typename A, size_t N, typename T> 
void Fill(A (&array)[N], const T &val) {
    std::fill( (T*)array, (T*)(array+N), val );
}
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << endl; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s; }
//----------------------------------------------------------------------------------------------

template< typename T >
struct edge {
  int to;
  T cost;
  edge(int to, T cost) : to(to), cost(cost) {}
};
 
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
 
template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
    const auto INF = numeric_limits< T >::max();
    vector< T > dist(g.size(), INF);
    using P = pair< T, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    dist[s] = 0;
    que.emplace(dist[s], s);
    while(!que.empty()) {
        auto [cost, v] = que.top();
        que.pop();
        if(dist[v] < cost) continue;
        for(auto &e : g[v]) {
            auto next_cost = cost + e.cost;
            if(dist[e.to] <= next_cost) continue;
            dist[e.to] = next_cost;
            que.emplace(dist[e.to], e.to);
        }
    }
    return dist;
}


int main() 
{
    int a,b,x,y;
    cin >> a >> b >> x >> y;
    a--; b--;
    WeightedGraph<int> g(200);
    rep(i,0,100) {
        g[2*i].emplace_back(2*i+1, x);
        g[2*i+1].emplace_back(2*i, x);
        if(i > 0) {
            g[2*i].emplace_back(2*i-1, x);
            g[2*i-1].emplace_back(2*i, x);
        }
    }
    
    rep(i,0,99) {
        g[2*i].emplace_back(2*i+2, y);
        g[2*i+2].emplace_back(2*i, y);
        g[2*i+1].emplace_back(2*i+3, y);
        g[2*i+3].emplace_back(2*i+1, y);
    }

    auto dis = dijkstra(g,2*a);
    cout << dis[2*b+1] << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,x,y,ans;
    cin>>a>>b>>x>>y;
    int d=fabs(a-b),mn=min(2*x,y);
    if(a==b) cout<<x<<endl;
    else if (a>b)
    {
        cout<<x+(d-1)*mn<<endl;
    }
    else cout<<x+(d)*mn<<endl;
    return 0;
}
