QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 256 MB Points totaux : 100

#17213. Pokémon

Statistiques

Marti wants to collect all $n$ different types of Pokémon. Every day over a period of $m$ days, he will catch exactly one Pokémon. His choice for a given day is independent of the other days. Now he is wondering in how many ways, after $m$ days, he will have caught at least one of each of the $n$ different types.

Unfortunately, as a freshman at a certain university, he is busy with other problems (like opening a bank account, what else 😉), so he leaves the task to you.

Two ways are considered different if, on any day of the period, the Pokémon caught in the two ways are of a different type.

Input

The only line of standard input contains the natural numbers $m$ and $n$.

Output

On the only line of standard output, print the found number modulo $1102024631$.

Constraints

  • $1 \le m \le 10^{18}$
  • $1 \le n \le 10^7$

Subtasks

Subtask Points Additional Constraints
1 5 $m, n \le 8$
2 5 $m, n \le 19$
3 10 $m, n \le 7000$
4 5 $n \le 100000, m \le n + \sqrt{n}$
5 50 $n \le 1500000$
6 25 None

Points for a given subtask are awarded only if all test cases provided for it are passed successfully.

Examples

Input 1

3 2

Output 1

6

Note 1

If we denote the types as 1 and 2, the ways corresponding to the days are $\{1, 1, 2\}, \{1, 2, 1\}, \{1, 2, 2\}, \{2, 1, 1\}, \{2, 1, 2\}, \{2, 2, 1\}$.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.