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

int main() {
    // your code goes here
// 	int t;
// 	cin>>t;
// 	while(t--)
// 	{
	    
	
// 	}
    unsigned long long int x,y,a,b,count=0;
    cin>>x>>y>>a>>b;
    while(1)
    {
        if(x*(a-1)>b)
        {
            break;
        }
        if(y<=x*a)
        break;
        x=x*a;
        count++;
    }
    if(x<y)
    count+=(y-x-1)/b;
    cout<<count<<endl;
    
	return 0;
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b;
  cin>>c>>d;
  cout << b-c << endl;
}