#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
main()
{
      ll x,y,a,b,ans=0;
      cin>>x>>y>>a>>b;
      while(1)
      {
          if(x>=1e9)
          {
              break;
          }
          else
          {
              if((a-1)*x<b)
              {
                  x=x*a;
              }
              else
              {
                  break;
              }
          }
          if(x<y)
          {
              ans++;
          }
          else
          {
              break;
          }
      }
      ans+=(y-1-x)/b;
      cout<<ans<<endl;
}

#include<bits/stdc++.h>
#include<vector>
#include<map>
#include<unordered_set>
#include<set>
using namespace std;
#define flush
#define pb push_back
#define ed endl
#define cout1(a) cout<<a
#define cout2(a,b) cout<<a<<b
#define cout3(a,b,c) cout<<a<<b<<c
#define ll long long
#define ld long double
#define db double
#define ull unsigned long long
#define mk make_pair
#define pll pair<ll,ll>
#define pldb pair<ldb,ldb>
#define ff first
#define ss second
#define vull vector<ull>
#define ub upper_bound
#define lb lower_bound
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<ll>())
#define vll vector<ll>//vll v; means vector<long long>v;
#define vb vector<bool>
#define vldb vector<ldb>
#define vpll vector<pll>
#define vpldb vector<pldb>
#define pqmin priority_qrueue<ll,vector<ll>,greater<ll>>  //minheap
#define pq priority_qrueue<ll> //maxheap
#define pqrpll priority_qrueue<pll>//pqr with pairs
#define mll map<long,long>
#define mldb map<ldb,ldb>
#define umll unordered_map<ll>
#define sll set<ll>
#define usll unordered_set<ll>
#define ppc(x) __builtin_popcount(x)
#define pp(x) __builtin_parity(x)
#define ppll(x) __builtin_parityll(x)
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define clzll(x) __builtin_clzll(x)
#define ctzll(x) __builtin_ctzll(x)
#define ppcll(x) __builtin_popcountll(x)
#define maxx 1e9+7
#define minn -(1e9+7)
ll mod=1000000000+7;
ll inf=1e17;
 //memset(dp, -1, sizeof dp);
//1<log(n)<sqrrt(n)<n<nlog(n)<n^2<n^3<........<2^n<3^n.....<n^n
/* n<=22    O((2^n)*n)                                           //__gcd(a,b) gives gcd of two numbers
n<=100   O(n^4)
n<=400  O(n^3)                                                //no of digits=floor(log10(n))+1;
n<=2000  O(n^2logn)
n<=10^4   O(n^2)                                              return(x&&(!(x&(x-)))); tell if x is power of 2;
n<=10^5or6 O(nlogn)                                           accumulate(v.begin(),v.end(),0);
n<=10^8    O(n),O(3.2*log(10)n),O(1)
n<=10^18   O(logn),O(1)


vector<int>::iterator it;
__lg(10)=3   to know
log(i)=log(i/2) + 1 recurrance relation to calculate the log value
log(10)=2.3059*log10(10)
log10(10)=1
cout<<setw(2)<<setfill('0')<<h<<':'<<setw(2)<<setfill('0')<<m<<ed;  set the feild width to 2 and default value is 0
*/
/*
NOTE-pow() funtion is not so precise






*/
const int N=1e5+5;
bool prime[N];


void solve()
{
int x,y,z;
cin>>x>>y>>z;
db val=(db)y/x;
int res=INT_MIN;
// cout<<val<<ed;
// cout<<res<<ed;
for(int i=0;i<1e6 + 5;i++)
{
if((db)i/z <val)
{
    if(i>res)
    {
      res=i;
    }
}
else
{
    break;
}
}
cout<<res<<ed;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
// prime[1]=false;
// for(int i=0;i*i<=N;i++)
// {
//  for(int j=i*i;j<=N;j+=i)
//  {
//     prime[j]=true
//  }
// }

solve();
return(0);
}