#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
ll x,y,a,b,s; 
int main(){
	cin>>x>>y>>a>>b;
	while(x<y/a&&x<(x+b)/a){
		x*=a;
		s++;
	}
	cout<<s+(y-1-x)/b<<'\n';
	return 0;
}

#include<bits/stdc++.h>
#include<chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;
#define ll long long int
#define ull unsigned long long int
#define FOR(I,a,b) for(int I=a;I<b;I++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(I,a,b) for(int I=a;I>=b;I--)
#define vec vector
#define vi vec<int>
#define vll vec<ll>
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define testcases ll t;cin>>t;while(t--)
#define mem(a,k) memset(a,k,sizeof(a))
#define FF first
#define SS second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<int,int>
#define vecin(a,n,index) for(int I=index;I<n;I++)cin>>a[I]
#define vecout(a,n,index) for(int I=index;I<n;I++)cout<<a[I]<<"\n";cout<<endl;
//ll mod = 1000000007;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
	ll x, y, a, b;
	cin >> x >> y >> a >> b;
	ll ans = 0;
	bool is = false;
	while (x * a <= x + b && x * a > 0) {
		x *= a;
		if (x >= y || x <= 0) {cout << ans << endl; is = true; br;}
		ans++;
	}
	if (!is) {
		ans += ((y - x - 1) / b);
		cout << ans << endl;
	}
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	// START FROM HERE :)
	solve();
}