#P8340. [AHOI2022] 山河重整

[AHOI2022] 山河重整

Problem Description

Ai and Lan, who live in the small universe No. 998244353998244353, received a message from the Resetters and decided to respond to the Return Movement. They need to return most of the matter to the greater universe, leaving only a tiny amount to rebuild their civilization in the new universe.

Their civilization has a total of nn key pieces of information, numbered 1,2,,n1, 2, \ldots, n. The information they keep is a subset SS of these key pieces. For a piece of information numbered xx, as long as there exists a subset of SS whose sum of numbers equals xx, then the message bottle they designed can restore xx in the new universe.

Ai and Lan wonder: how many ways are there to choose the subset SS so that all key information 1,2,,n1, 2, \ldots, n can be restored? Ai and Lan naturally computed the exact number of ways in just 11 microsecond, and now they want you to help verify it. Since the number of ways may be very large, you only need to output the result modulo MM.

Input Format

One line contains two positive integers N,MN, M.

Output Format

Output one line with one integer, which is the answer modulo MM.

4 1000000007

3

10 1000000007

180

1000 65472

2136

100000 100

96

Hint

Sample Explanation #1

There are in total the following 33 sets that satisfy the condition:

  • {1,2,3}\{ 1, 2, 3 \}
  • {1,2,4}\{ 1, 2, 4 \}
  • {1,2,3,4}\{ 1, 2, 3, 4 \}

Constraints

For 100%100 \% of the testdata, it is guaranteed that 1N5×1051 \le N \le 5 \times {10}^5, 2M1.01×1092 \le M \le 1.01 \times {10}^9.

Test Point ID NN \le MM \le
121 \sim 2 2020 1.01×1091.01 \times {10}^9
343 \sim 4 100100
565 \sim 6 50005000
77 3×1053 \times {10}^5 127127
88 5×1055 \times {10}^5
99 3×1053 \times {10}^5 1.01×1091.01 \times {10}^9
1010 5×1055 \times {10}^5

Translated by ChatGPT 5