#P5644. [PKUWC2018] 猎人杀
[PKUWC2018] 猎人杀
Description
Hunter Kill is a folk version of the once-popular game “Werewolf”. The rules are as follows.
At the beginning, there are hunters. The -th hunter has a hatred value . Each hunter has only one fixed skill: after dying, they must fire one shot, and the person who is shot will also die.
However, choosing whom to shoot is also important. Suppose the hunters still alive are . Then the probability of shooting hunter is .
At the beginning, the first shot is fired by you, and the target is chosen in the same way as the hunters (that is, hunter is hit with probability ). Due to the chain reaction caused by shooting, all hunters will eventually die. Now hunter wants to know the probability that they are the last one to die.
Output the answer modulo .
Input Format
The first line contains a positive integer .
The second line contains positive integers. The -th positive integer denotes .
Output Format
Output the answer.
3
1 1 2
915057324
Hint
Sample Explanation
The answer is $\frac{2}{4}\times \frac{1}{2}+\frac{1}{4}\times \frac{2}{3}=\frac{10}{24}$.
For of the testdata, .
For of the testdata, .
For of the testdata, .
For another of the testdata, , and .
For another of the testdata, , and .
For of the testdata, , and .
Translated by ChatGPT 5
京公网安备 11011102002149号