#ABC241H. [ABC241Ex] Card Deck Score

[ABC241Ex] Card Deck Score

Score : 600600 points

Problem Statement

There are some cards. Each card has one of NN integers written on it. Specifically, there are BiB_i cards with AiA_i written on them. Next, for a combination of MM cards chosen out of these (B1+B2+BN)(B_1+B_2\cdots +B_N) cards, we define the score of the combination by the product of the integers written on the MM cards. Supposed that cards with the same integer written on them are indistinguishable, find the sum, modulo 998244353998244353, of the scores over all possible combinations of MM cards.

Constraints

  • 1N161 \leq N \leq 16
  • 1M10181 \leq M \leq 10^{18}
  • 1Ai<9982443531 \leq A_i < 998244353
  • 1Bi10171 \leq B_i \leq 10^{17}
  • If iji\neq j, then AiAjA_i \neq A_j.
  • MB1+B2+BNM\leq B_1+B_2+\cdots B_N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

ANA_N BNB_N

Output

Print the answer.

3 3
3 1
5 2
6 3
819

There are 66 possible combinations of 33 cards.

  • A combination of 11 card with 33 written on it, and 22 cards with 55 written on them.
  • A combination of 11 card with 33 written on it, 11 card with 55 written on it, and 11 card with 66 written on it.
  • A combination of 11 card with 33 written on it, and 22 cards with 66 written on them.
  • A combination of 22 cards with 55 written on them, and 11 card with 66 written on it.
  • A combination of 11 card with 55 written on it, and 22 cards with 66 written on them.
  • A combination of 33 cards with 66 written on them.

The scores are 7575, 9090, 108108, 150150, 180180, and 216216, respectively, for a sum of 819819.

3 2
1 1
5 2
25 1
180

"A combination of a card with 11 and another card with 2525" and "a combination of two cards with 55 written on them" have the same score of 2525, but they are considered to be different combinations.

10 232657150901347497
139547946 28316250877914575
682142538 78223540024979445
110643588 74859962623690081
173455495 60713016476190629
271056265 85335723211047202
801329567 48049062628894325
864844366 54979173822804784
338794337 69587449430302156
737638908 15812229161735902
462149872 49993004923078537
39761306

Be sure to print the answer modulo 998244353998244353.