#include<cstdio> #include<utility> usingnamespace std; typedeflonglong LL; typedef pair<int, int> PII; constint N = 2e3 + 10, mod = 998244353; PII p[N]; int n, k; LL binpow(LL b, int k) { LL res = 1; while (k) { if (k & 1) res = res * b % mod; b = b * b % mod; k >>= 1; } return res; } intmain() { scanf("%d%d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].first, &p[i].second); LL res = 0; for (int i = 1; i <= n; i++) { LL s = p[i].second; for (int j = 1; j <= n; j++) if (i != j) s = s * (k - p[j].first) % mod * binpow(p[i].first - p[j].first, mod - 2) % mod; res = (res + s) % mod; } printf("%lld", (res % mod + mod) % mod); return0; }