#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
int a,b,x,y;
int solve()
{
	if(a==b) return x;
	int dis=abs(a-b);
	dis--;
	int ans=x;
	if(a>b) ans+=dis*min(y,2*x);
	if(a<b) ans+=(dis+1)*min(y,2*x);
	return ans;
}
int main()
{
	//freopen("1.txt","r",stdin);
	scanf("%d%d%d%d",&a,&b,&x,&y);
	cout<<solve()<<endl;
	//fclose(stdin);
}
	
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d=0;
	cin>>a>>b>>c;
	if(a==1) d=d+6;
	else if(a==2) d=d+5;
	else if(a==3) d=d+4;
	else if(a==4) d=d+3;
	else if(a==5) d=d+2;
	else if(a==6) d=d+1;
	if(b==1) d=d+6;
	else if(b==2) d=d+5;
	else if(b==3) d=d+4;
	else if(b==4) d=d+3;
	else if(b==5) d=d+2;
	else if(b==6) d=d+1;
	if(c==1) d=d+6;
	else if(c==2) d=d+5;
	else if(c==3) d=d+4;
	else if(c==4) d=d+3;
	else if(c==5) d=d+2;
	else if(c==6) d=d+1;
	cout<<d<<endl;
	return 0;
 } 