#pragma GCC optimize("Ofast") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast(chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } constexpr ll mod = 998244353; // 0-indexed struct BIT{ vector s; BIT(int n): s(n){} void update(int pos,ll dif){ for(;pos0;pos&=pos-1)(res+=s[pos-1])%=mod; return res; } }; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector x(n),y(n); for(int i=0;i> x[i] >> y[i]; ll X = x[i]+y[i]; ll Y = x[i]-y[i]; x[i] = X; y[i] = Y; } if(x[0] > x[n-1]){ for(int i=0;i y[n-1]){ for(int i=0;i X,Y; for(int i=0;i idx(m); for(int i=0;i dp(m); dp[0] = 1; BIT bit(m); bit.update(Y[0], dp[0]); for(int _i=1;_i