#include using namespace std; const long long MOD = 998244353; long long modpow(long long a, long long b){ long long ans = 1; while (b > 0){ if (b % 2 == 1){ ans *= a; ans %= MOD; } a *= a; a %= MOD; b /= 2; } return ans; } long long modinv(long long a){ return modpow(a, MOD - 2); } int main(){ int N, X; cin >> N >> X; vector x(N), y(N); for (int i = 0; i < N; i++){ cin >> x[i] >> y[i]; } long long ans = 0; vector> dp(2, vector(N + 1, 0)); for (int j = 0; j < N; j++){ dp[0][0] = 1; dp[1][0] = 0; for (int i = 0; i < N; i++){ if (i == j){ dp[0][i + 1] = dp[0][i]; dp[1][i + 1] = dp[1][i]; } else { long long P = (X - x[i] + MOD) * modinv(x[j] - x[i] + MOD) % MOD; dp[0][i + 1] = dp[0][i] * P % MOD; dp[1][i + 1] = (dp[1][i] * P + dp[0][i]) % MOD; } } ans += dp[1][N] * y[j] % MOD; } ans %= MOD; cout << ans << endl; }