#include<bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 400005;
const int INF = 1e12;
signed main()
{
    FAST
    int tc=1;
    // cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        ld r,x,y;
        cin>>r>>x>>y;
        x *= x;
        y *= y;
        ld d = sqrt(x+y);
        int ans = d/r;
        ans += (1 + (!ans))*(ans*r != d);
        cout<<ans<<endl;
    }
    return 0;
}
//
#include <bits/stdc++.h>
const int INF=0x3f3f3f3f;
const int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int a,b,x,y;
	cin>>a>>b>>x>>y;
	if(b>a){
		if(2*x<y)
			cout<<(b-a)*2*x+x<<endl;
		else
			cout<<(b-a)*y+x<<endl;
	}
	else if(a==b)
		cout<<x<<endl;
	else{
		if(2*x<y)
			cout<<(a-b-1)*2*x+x<<endl;
		else
			cout<<(a-b-1)*y+x<<endl;
	}
	return 0;
}