#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
    vector<ll>v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(v.begin(),v.end());
    if(v[0]!=v[1] and v[1]!=v[2] and v[0]!=v[2])cout<<0;
    else {
        if(v[0]==v[1])cout<<v[2];
        else cout<<v[0];
    }
    cout<<endl;
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(c*d==b)
    {
        cout<<"-1";
        return 0;
    }
    ll num=c*d-b;
    ll ans=(a+num-1)/num;
    if(ans<=0)
    {
        cout<<"-1";
        return 0;
    }
    cout<<ans;
}