// Coder: @SumitRaut
#include <bits/stdc++.h>

#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(12)
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
#define sbc __builtin_popcount
#define pb push_back
#define pbk pop_back
#define em emplace
#define emb emplace_back
#define ff first
#define ss second
#define ll long long
const ll mod = 1e9 + 7;

template<typename T> void smax(T& a, T b) { if(a<b) a=b; }
template<typename T> void smin(T& a, T b) { if(a>b) a=b; }
template<typename T> T pw(T a,T b) { T p=1,one=1; while(b) { if(b&one) p=p*a; a=a*a; b >>=1; } return p; }
template<typename T> T pwm(T a,T b,T md=mod) { T p=1,one=1; while(b) { if(b&one) p=p*a%md; a=a*a%md; b >>=1; } return p; }

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (auto &it:v)
        is >> it;
    return is;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &it) {
    os << it.first << ' ' << it.second;
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const array<T, 2> &v) {
    for (auto &it : v) os << it << ' ';
    return os;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (auto &it : v)
        os << it << ' ';
    return os;
}

#ifndef ONLINE_JUDGE
class Timer { chrono::high_resolution_clock::time_point start_t, end_t; public: Timer() { start_t=chrono::high_resolution_clock::now(); } ~Timer() { end_t = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(end_t-start_t); cerr<<"\nRunTime: "<<duration.count()<<"ms"<<'\n'; } };
void debug() { cerr << '\n'; }

template<typename T, typename... Args>
void debug(T print, Args... args) {
    cerr << ' ' << print;
    debug(args...);
}

#define deb(...) cerr << "[" << #__VA_ARGS__ << "]" << " --> ", debug(__VA_ARGS__)
#else
#define deb(...) void(0)
#endif

void solve() {
    int a, b, x, y;
    cin>>a>>b>>x>>y;
    if(a==b||a==b+1) {
    	cout<<x<<'\n';
		return;
	}
	if(a>b) --a;
	cout<<x+min(2*x,y)*(abs(a-b))<<'\n';
}

int main() {
#ifndef ONLINE_JUDGE
    Timer timer;
#endif
    speedup;
    //int t; cin>>t; while(t--)
    solve();
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

#define debug(x) cout << #x << " is " << x << endl
#define inc(i, a, b) for (int i = a; i <= b; ++i)
typedef long long ll;
const int INF = 0x3f3f3f3f;

int a, b, x, y;

int main() 
{
	scanf("%d%d%d%d", &a, &b, &x, &y);
	if (a > b) printf("%d\n", min(2 * (a - b - 1) * x + x, (a - b - 1) * y + x));
	else printf("%d\n", min(2 * (b - a) * x, (b - a) * y) + x);
    return 0;
}