Power Sum

All submissions for this problem are available.
### Read problem statements in [Hindi](http://www.codechef.com/download/translated/SEPT19/hindi/PSUM.pdf), [Bengali](http://www.codechef.com/download/translated/SEPT19/bengali/PSUM.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/SEPT19/mandarin/PSUM.pdf), [Russian](http://www.codechef.com/download/translated/SEPT19/russian/PSUM.pdf), and [Vietnamese](http://www.codechef.com/download/translated/SEPT19/vietnamese/PSUM.pdf) as well. Chef is preparing a brand new dish. He found $N$ new ingredients (numbered $1$ through $N$) for the dish. For each valid $i$, the $i$th ingredient costs $C_i$ dollars and it has value $V_i$. Chef has a budget: $S$ dollars. He can buy each ingredient at most once. A nonempty subset of these $N$ ingredients (possibly containing all ingredients) is called *affordable* if the sum of costs of all the ingredients in the subset does not exceed Chef's budget. The *tastiness* of a dish prepared using a set of ingredients is equal to $v^K$, where $v$ is the sum of values of all the ingredients in the set and $K$ is a fixed integer. To make a dish, Chef should use an affordable subset of ingredients. He wants to try out all the dishes he can make. Find the total (summed up) tastiness of all these dishes. Since this number could be very large, compute it modulo $998,244,353$. ### Input  The first line of the input contains three spaceseparated integers $N$, $S$ and $K$.  $N$ lines follow. For each $i$ ($1 \le i \le N$), the $i$th of these lines contains two spaceseparated integers $C_i$ and $V_i$. ### Output Print a single line containing one integer ― the total tastiness modulo $998,244,353$. ### Constraints  $1 \le N, S \le 100$  $1 \le K \le 2,000$  $1 \le C_i \le 100$ for each valid $i$  $1 \le V_i \le 10^9$ for each valid $i$ ### Subtasks **Subtask #1 (10 points)**: $1 \le N \le 20$ **Subtask #2 (30 points)**: $1 \le K \le 100$ **Subtask #3 (60 points)**: original constraints ### Example Input ``` 3 2 2 1 2 2 3 1 4 ``` ### Example Output ``` 65 ``` ### Explanation Chef can make dishes using the following subsets of ingredients:  $\{1\}$ with tastiness $2^2 = 4$  $\{2\}$ with tastiness $3^2 = 9$  $\{3\}$ with tastiness $4^2 = 16$  $\{1, 3\}$ with total value $6^2 = 36$ The subsets $\{1, 2\}$, $\{2, 3\}$ and $\{1, 2, 3\}$ cannot be used because they are not affordable.Author:  rumblefool 
Editorial  https://discuss.codechef.com/problems/PSUM 
Tags  anand20, convolution, ntt, polynomial, powerseries, rumblefool, sept19 
Date Added:  15082019 
Time Limit:  3 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 