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

int main() {
    __int128_t X;
    ll x, y, a, b;
    cin >> x >> y >> a >> b;
    ll v = 0;
    while (true) {
        if (x < y) {
            X = (__int128) x * (__int128) a;
            if (X > b || X >= y - 1) break;
            v++;
            x = x * a;
        } else {
            break;
        }
    }
    ll t = (y - 1 - x) / b;
    v += t;
    cout << v << "\n";
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using vl = vector<long long>;
using vi = vector<int>;

int main(){
    double x,y,z; cin >> x >> y >> z;
    double ans;
    if(x == z) ans = y-1;
    else{
        ans = floor(((double)y/(double)x*(double)z));
        if(y/x == ans/z) ans--;
    }
    cout << ans << endl;
}