#P10514. 考试
考试
Background
Life has dreams, and everyone can be wonderful in their own way.
Problem Description
There are students taking an exam, and the exam has problems.
All students have the same ability, but the difficulty of each problem may be different. For the -th problem, there will be a random students who answer it wrong.
After the exam, students are chosen uniformly at random. Find the probability that all of these students answered every problem correctly. Output the answer modulo .
Input Format
The first line contains three integers .
The second line contains integers, where the -th number represents .
Output Format
Output one integer, the answer modulo .
5 5 2
1 2 1 2 2
793364682
Hint
Sample Explanation
The probability that all randomly chosen students answer everything correctly is . Taking it modulo , the answer is .
It can be proven that the answer is always a rational number. If you are not familiar with taking a rational number modulo, you can refer to 【Template】Remainder of a Rational Number.
Constraints
- For of the testdata, .
- For another of the testdata, .
- For another of the testdata, , .
For all testdata, it is guaranteed that and .
Translated by ChatGPT 5