#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define rep(i, n) FOR(i,0,n)
#define irep(i, n) IFOR(i,0,n)
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
using VI = vector<int>;
using VLL = vector<ll>;
using VB = vector<bool>;
using VP = vector<P>;
using Graph2 = vector<vector<int>>;
using PQ = priority_queue<int>;
template<typename T>istream& operator>>(istream&s,vector<T>&v){for(auto &i: v)s>>i;return s;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
bool second_compare(P a,P b){if(a.second!=b.second){return a.second<b.second;} else return true;}

int main() {
    ll x, y, a, b;
    cin >> x >> y >> a >> b;
    ll ans = 0;
    while(1) {
        if ((double)x <= (double)(x + b)/a && x * a < y) {
            ans++;
            x *= a;
        }
        else break;
    }

    ans += (y-x) / b;
    if ((y-x) % b == 0) ans--;

    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,x,n) for(int i = x;i <= n;++i)
#define forr(i,x,n) for(int i = n;i >= x;--i)
#define Angel_Dust ios::sync_with_stdio(0);cin.tie(0)

const int N = 1005;
struct Node
{
    string name;int h;
    bool operator<(const Node& r)   const
    {
        return h < r.h;
    }
}a[N];

int main()
{


    Angel_Dust;
    int n;cin >> n;
    forn(i,1,n) cin >> a[i].name >> a[i].h;
    sort(a + 1,a + n + 1);
    cout << a[n - 1].name << endl;

    return 0;
}
