#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)


void solve(long long X, long long Y, long long A, long long B) {

    ll exp_a = 0;
    while (true) {
        if (X > Y / A) break;
        if (X * A >= X + B) break;
        if (X * A >= Y) break;

        X *= A;
        exp_a++;
    }
    ll exp_b = floor((long double) (Y - X - 1) / B);
    cout << exp_a + exp_b << endl;
}

int main() {
    long long X;
    scanf("%lld", &X);
    long long Y;
    scanf("%lld", &Y);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(X, Y, A, B);
    return 0;
}

#include<cstdio>
#include<cstring>
using namespace std;
bool a[11000];
int main()
{
	memset(a,false,sizeof(a));
	for(int i=6;i<=10000;i+=6)a[i]=true;
	for(int i=10;i<=10000;i+=10)a[i]=true;
	for(int i=15;i<=10000;i+=15)a[i]=true;
	int n;scanf("%d",&n);
	printf("6 10 15");a[6]=a[10]=a[15]=false;
	n-=3;
	for(int i=1;i<=10000;i++)
	{
		if(n==0)return 0;
		if(a[i]){printf(" %d",i);n--;}
	}
	return 0;
}