#include<iostream>
using namespace std;
int main(){
  int a,b,x,y,ans;
  cin>>a>>b>>x>>y;
  
  if(a>b)
    if(2*x<y)
      ans=2*x*(a-b)-x;
  	else
      ans=x+y*(a-b-1);
  else
    if(2*x<y)
      ans=2*x*(b-a)+x;
  	else
      ans=x+y*(b-a);
  
  cout<<ans;
}
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const long long MOD = 1000000007;

signed main(){
    ll a, b, x, y;
    cin >> a >> b >> x >> y;
    ll t = 0;
    if(a == b){
        PRINT(x);
    }else if(a > b){
        t += (a - b - 1) * min(2 * x, y);
        t += x;
        PRINT(t);
    }else{
        t += (b - a) * min(2 * x, y);
        t += x;
        PRINT(t);
    }
    return 0;
}