#P15667. [ICPC 2025 Jakarta R] Predisposed
[ICPC 2025 Jakarta R] Predisposed
题目描述
You are given two integers and . You are also given constraints in the form .
A sequence of length is if and only if:
- For each , it holds that .
- For each , the sum of all where is a multiple of is equal to under modulo . Formally, .
Find the number of all possible predisposed sequences. As the answer can be quite large, compute it modulo .
输入格式
The first line contains three integers , , and (; ).
Each of the next lines contains two integers and (; ; for ) representing a constraint.
输出格式
Output an integer in a single line representing the number of predisposed sequences modulo .
2 3 2
1 0
2 1
1
100000 100000 1
100000 0
373304036
提示
The only predisposed sequence is .