#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
     int a,b,c,d;
     cin >> a >> b >> c >> d;
     if( b-c*d==0)
     {
         cout << -1 << endl;
     }
     else
     {
         int k=(c*d-b);
         if(k<0)
         {
             cout << -1 << endl;
         }
         else if(a%k==0)
         {
             cout << a/k << endl;
         }
         else
         {
             cout << a/k +1 << endl;
         }
     }
}
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	ll x, y, a, b;
	cin >> x >> y >> a >> b;
	
	ll curr = x;
	ll ans = 0;
	while(curr < y) {
		if(y / a <= curr) break;
		if(curr * a < curr + b) {
			++ans;
			curr *= a;
		}
		else break;
	}
	ans += ((y - 1) - curr) / b;
	cout << ans;
}
