#include #include using namespace std; using namespace atcoder; #define rep(i,n) for(ll i=0;i=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define pqueue(x) priority_queue,greater> #define all(x) (x).begin(),(x).end() #define CST(x) cout<> #define rev(x) reverse(x); using ll=long long; using vl=vector; using vvl=vector>; using pl=pair; using vpl=vector; using vvpl=vector; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[9]={0,1,-1,0,1,1,-1,-1,0}; const ll dx[9]={1,0,0,-1,1,-1,1,-1,0}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using mint=modint998244353; mint p1,p2,q1,q2; vector a(1000010); vector dp(1000010); void induce(ll l,ll mid,ll r){ vector ds; vector nds; for(ll i=l;i> hoge[i]; //cin >> p1.val() >> p2.val() >> q1.val() >> q2.val(); p1=hoge[0];p2=hoge[1]; q1=hoge[2];q2=hoge[3]; ll n;cin >> n; a[0]=1; q1/=q2; p1/=p2; mint c=1; for(ll i=1;i<=n;i++){ c*=q1; a[i]=a[i-1]*c; } dfs(0,n+1); //rep(i,n+1)cout << dp[i] <<" ";cout << endl; cout << dp[n].val() << endl; }