#include<bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
void solve()
{
  int a,b,c,d,r;
  cin>>a>>b>>c>>d;
  r=(d*c)-b;
  if(r<=0)
    cout<<-1;
  else
  {
    db s=ceil(db(a)/db(r));
    cout<<int(s);
  }
  }
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repx(i, x, n) for (ll i = (ll)(x); i < (ll)(n); i++)
#define repr(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define reprx(i, x, n) for (ll i = ((ll)(n)-1); i >= (ll)(x); i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((ll)(x).size())
#define submit(x) {cout<<x<<endl; return 0;}
#define X first
#define Y second
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T>bool chmax(T &a,T b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a,T b) {if (b<a) {a=b; return 1;} return 0;}
template<class T>long long square(T a) {return a*a;}
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 1LL << 60;
const double PI = 3.1415926535897932;

int main()
{
  ll x,y,a,b;
  cin>>x>>y>>a>>b;
  ll exp=0;
  ll change=0;
  ll copy_x=x;
  while(copy_x < b && copy_x*(a-1) < b)
  {
    copy_x *= a;
    change++;
  }
  y -= x;
  rep(i, change)
  {
    y -= x*(a-1);
    x *= a;
    if (y<=0) submit(exp);
    exp++;
  }
  exp += y/b - (y%b==0);
  submit(exp)
}
