/// Solution No.:

/// Approach:

/// Complexity: space:  O()
///             time:   O()

/// Comment:

/// Verdict:

/// Report:


#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <string.h>
#include <climits>
#include <set>
#include <cassert>
#include <cfloat>
#include <stack>
#include <unordered_map>
#include <functional>
#include <chrono>

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

/// Recommended not to use
///using namespace std;
///using namespace __gnu_pbds;

#define p(x) std::cout<<#x<<" = "<<x<<"\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod1 1000000007
#define mod2 998244353
#define absolute(x) (((x)<0)?(-(x)):(x))

/// #define _DEBUG

typedef long long int ll;
typedef unsigned long long llu;
typedef long double lld;
template <class T> using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<class T> using matrix = std::vector<std::vector<T>>;

/// lld pi = 2 * acos(0.0);   /// precision error
lld pi = 2 * acosl(0.0);

int test_case_number, test_case=1;

/// Direction Array
/// int dx[]={0, 0, 1, -1, -1, 1, -1, 1};
/// int dy[]={-1, 1, 0, 0, 1, 1, -1, -1};

/// typedef struct
/// {
///
/// } structure;

///place for problem specific functions


void function_name()
{
    int a, b, x, y;
    scanf("%d %d %d %d",&a, &b, &x, &y);
    int answer =0;
    if(a==b)
    {
        answer = x;
    }
    else if(b<a)
    {
        b++;
        answer= x+(a-b)*(std::min(2*x, y));
    }
    else if(a<b)
    {
        answer = x+(b-a)*(std::min(2*x, y));
    }
    printf("%d\n", answer);
}
void function_name(int v1, int v2, int v3)
{

}
void function_name(std::string line)
{

}
class initial_works
{
public:

    void with_test_case_number()
    {
        scanf("%d", &test_case_number);
        ///getchar();
        while(test_case <= test_case_number)
        {
            function_name();
            test_case++;
        }
    }

    void single_iteration()
    {
        function_name();
    }

    void without_test_case_number()
    {
        int v1, v2, v3;
        while(scanf("%d %d %d", &v1, &v2, &v3)==3 && v1!=0)
        {
            function_name(v1, v2, v3);
            test_case++;
        }
    }

    void eoof()
    {
        char dummy_char_array[100]={0};
        while(scanf("%[^\n]", &dummy_char_array)!=EOF)
        {
            ///it only takes the absence of one getchar to ruin your life. Don't understand remove the getchar below and then input the sample input
            getchar();
            ///if not given getchar. the dummu_char_array will not take new input as there is newline after the first input is taken. It will continue with the previous value.
            /// So, the function will run with same argument.
            std::string line = dummy_char_array;
            function_name(line);
            test_case++;
        }
    }
};


int main()
{
    //std::ios_base::sync_with_stdio(false);
    #ifdef _DEBUG
        ///freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    initial_works a;
    a.single_iteration();

    return 0;
}

#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
#define pb push_back
#define ll long long int
#define pll pair<ll,ll>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,x,y;
    cin>>a>>b>>x>>y;
    int ans = x+min(abs(b+1-a)*y,abs(b-a)*y);
    if(a>b){
    	ans = min(ans,2*x*(a-b)-x);	
	}else if(b>a){
		ans = min(ans,2*x*(b-a)+x);
	}
	cout<<ans;
	return 0;
}