#11. 名無声

名無声

Background

After a month of intense practice on Codeforces, Atom has honed his skills and is finally ready for an official contest. However, fate still seems to have a challenge in store for him…

Problem Statement

Due to certain special and indescribable reasons, Atom is forced to skip exactly kk of Professor E’s classes. The timing of these events is random, and for Atom, each class has an equal probability of being skipped, with the total number of missed classes exactly equal to kk.

Atom has a predictive model that estimates the probability pip_i of being called upon in each class by Professor E, where pi=aibip_i = \frac{a_i}{b_i}. Atom wants to calculate the expected number of times he will be called upon when he’s absent (i.e., the expected number of missed classes where he’s called upon), with the result modulo 998244353998244353.

Input

The input consists of n+1n+1 lines:

  • The first line contains two positive integers nn and kk, representing the total number of classes and the number of classes Atom will skip.
  • The next nn lines each contain two integers aia_i and bib_i, representing the probability pi=aibip_i = \frac{a_i}{b_i} that Atom will be called upon in the ithi^{th} class.

Output

Output a single integer, the expected number of times Atom will be called upon while absent, modulo 998244353998244353.

Example

Input 1

3 1
0 1
0 1
6 6

Output 1

332748118

Example Explanation

Atom has 3 classes, and he needs to skip 1 class. Therefore, the probability of being forced to skip each class is 13\frac{1}{3}, and the probabilities of being called in each class are 0,0,0, 0, and 11, respectively.

The only situation in which he will be caught is if he skips the 3rd class, with a probability of 13×1=13\frac{1}{3} \times 1 = \frac{1}{3}.

In modulo 998244353998244353, 13\frac{1}{3} is represented as 332748118332748118.

Constraints

  • 1kn5×1051 \leq k \leq n \leq 5 \times 10^5
  • 0aibi1060 \leq a_i \leq b_i \leq 10^6, and bi0b_i \neq 0

In the modulo 998244353998244353 context, ab\frac{a}{b} can be represented as a×b1a \times b^{-1}, where b1b^{-1} is the modular inverse of bb modulo 998244353998244353.

Hint: Fermat's Little Theorem is a useful tool in number theory. For a prime pp, if an integer aa is not divisible by pp, then ap11(modp)a^{p-1} \equiv 1 \pmod{p}, which implies that a×ap21(modp)a \times a^{p-2} \equiv 1 \pmod{p}. Therefore, ap2a^{p-2} is the modular inverse of aa modulo pp.