#P16809. [蓝桥杯 2026 国 Python A] 前缀奇偶
[蓝桥杯 2026 国 Python A] 前缀奇偶
Problem Description
Xiao Lan has tasks in hand. The time costs of the tasks are all different: minute, minutes, , minutes.
Xiao Lan needs to choose an order to complete these tasks one by one. Each time he finishes a task, he records the total accumulated time from the start up to the current moment.
Suppose that in some execution order, the task times are . Then when finishing the -th task, the recorded accumulated total time is:
$$\begin{aligned} S_i = a_1 + a_2 + \dots + a_i \end{aligned}$$If among the recorded times , exactly of them are even, then this execution order is considered valid.
Now please help Xiao Lan compute how many different execution orders are valid in total. Since the answer may be very large, you only need to output the result modulo .
Input Format
Input one line containing two integers .
Output Format
Output one integer, representing the answer.
3 1
2
Hint
Sample Explanation
When , the valid execution orders are:
and
Take the order as an example. The three completion times are , and only is even.
Constraints and Notes for Test Cases
For of the test cases, .
For of the test cases, .
For all test cases, , .
Translated by ChatGPT 5