/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx", "avx2", "fma")
#pragma GCC optimization("unroll-loops")
*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
#define lb lower_bound
#define ub upper_bound
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 998244353;
const ll inf = 0x3f3f3f3f;
const ll llinf = 1e18;
const ll nax = 0;

int main(){
	IOS
	ll a, b, c; cin >> a >> b >> c;
	ll satu=a*(a+1)/2%mod;
	ll dua=b*(b+1)/2%mod;
	ll tiga=c*(c+1)/2%mod;
	cout << ((satu*dua)%mod*tiga)%mod << '\n';
}
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=5e5+50;
const ll mod=1e9+7;
using namespace std;

ll x,y,a,b, ans;
int main()
{
    //freopen("sol.in","r",stdin);
    //freopen("sol.out","w",stdout);
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
   	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin >> x >> y >> a >> b;
    while((double)a*x<=2e18 && a*x < y && x*a <= x+b){
        x *= a;
        ans++;
    }
    cout << ans + (y - x - 1)/b << endl;
    return 0;
}

