#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
vector<pair<int,int>> g[205];
int dis[205];
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
int main(){
	int i,n,a,b,x,y;
	scanf("%d%d%d%d",&a,&b,&x,&y);
	for(i=1;i<=100;i++){
		g[i].emplace_back(i+100,x);
		g[i+100].emplace_back(i,x);
	}
	for(i=2;i<=100;i++){
		g[i].emplace_back(i-1+100,x);
		g[i+99].emplace_back(i,x);
	}
	for(i=1;i<=99;i++){
		g[i].emplace_back(i+1,y);
		g[i+1].emplace_back(i,y);
	}
	for(i=101;i<=199;i++){
		g[i].emplace_back(i+1,y);
		g[i+1].emplace_back(i,y);
	}
	pq.push({0,a});
	for(i=1;i<=200;i++)
		dis[i]=1000000000;
	dis[a]=0;
	while(pq.size()){
		auto v=pq.top();
		pq.pop();
		for(auto x:g[v.second]){
			if(dis[x.first]>dis[v.second]+x.second){
				dis[x.first]=dis[v.second]+x.second;
				pq.push({dis[x.first],x.first});
			}
		}
	}
	printf("%d\n",dis[100+b]);
}

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int sum=0,nega=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')nega=-1;ch=getchar();}
	while(ch<='9'&&ch>='0')sum=sum*10+ch-'0',ch=getchar();
	return sum*nega;
}
int a,b,x,y,sum;
int main()
{
	a=read(),b=read(),x=read(),y=read();
	sum=abs(b-a);
	if(a>b)cout<<min((sum*2-1)*x,x+(sum-1)*y)<<endl;
	else cout<<min((sum*2+1)*x,sum*y+x)<<endl; 
	//cout<<min((sum*2-1)*x,x+)<<endl;
	return 0;
}
