#include<bits/stdc++.h> usingnamespace std; #define int long long constint mod = 998244353; constint N = 2010; int n, k; int x[N], y[N]; intqpow(int x, int y){ x %= mod; int ans = 1; while (y) { if (y & 1) ans = (ans * x) % mod; y >>= 1; x = (x * x) % mod; } return ans; } intinv(int x){ returnqpow(x, mod - 2); } signedmain(){ cin >> n >> k; int ans = 0; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i]; } for (int i = 1; i <= n; i++) { int mum = 1; int son = y[i]; for (int j = 1; j <= n; j++) { if (j == i) continue; son = son * (k - x[j]) % mod; mum = mum * ((x[i] - x[j] % mod) % mod) % mod; } ans += son * inv(mum) % mod; ans = (ans + mod) % mod; } cout << ans; }