#P4241. 采摘毒瘤
采摘毒瘤
Description
There are different types of tumors by the roadside. For type , there are items available, and each item occupies units of space. Salamander’s bag has a maximum total volume capacity of .
Salamander is very greedy, but he does not require taking as many items as possible or achieving the largest possible total volume. He only requires that the bag can no longer fit any tumor of any remaining type.
Formally, choose integers with for each , such that , and if then the remaining capacity for every such .
Salamander wants to know how many different packing schemes there are. Two schemes are different if and only if the set of types taken is different, or there exists at least one type for which the taken quantity is different. Since the number of schemes can be large, output the answer modulo .
Input Format
The first line contains two positive integers and , the number of tumor types and the bag’s capacity.
Each of the next lines contains two positive integers and , describing one type of tumor.
Output Format
Output a single line with the number of different schemes, modulo .
2 5
2 3
3 1
2
Hint
Sample explanation:
The two schemes are as follows:
- Take 1 item of type 1 and 2 items of type 2.
- Take 3 items of type 2.
Constraints
- For 10% of the testdata, , ;
- For 30% of the testdata, , ;
- For another 20% of the testdata, ;
- For 100% of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号