#include #include using namespace std; using ll=long long; ll modulo(ll a, ll mod){ ll b=a%mod; if (b>=0) return b; else return b+mod; } ll sum_mod(vector a,ll mod){ ll x=0; for (auto p:a) x=modulo(x+p,mod); return x; } ll pow_mod(ll a, ll k, ll mod){ ll x=1; while (k){ if (k&1){ x=modulo(x*a,mod); } a=modulo(a*a,mod); k>>=1; } return x; } ll S(ll b,ll M,ll Mod){ ll x=modulo(b,Mod); x*=b+1; x=modulo(x,Mod); x*=b+2; x=modulo(x,Mod); x*=modulo(4*M+3-3*b,Mod); x=modulo(x,Mod); return x; } int main(){ ll t,v; ll x=0; ll Mod=998244353; int N; cin >> N; vector T(N,0),V(N,0); for (int i=0;i> T[i] >> V[i]; } ll T_sum=sum_mod(T,Mod); ll X=0; ll p=1; for (int i=0;i