单点时限: 2.0 sec
内存限制: 512 MB
After thousands of battles, the astrologer Komorebi
, the warrior Amuzi
and the samurai lbromine
finally defeat the Elden Beast and get the Elden Remembrance. As usual, they decide to fight a duel to determine the ownership of the trophy.
They all have a deadly skill, but the skill will not hit the target certainly. Formally, Komorebi
‘s skill has the probability of $P_1$ to hit the target, Amuzi
‘s skill has the probability of $P_2$ to hit the target, and lbromine
‘s skill has the probability of $P_3$ to hit the target. And once the skill hits the target, the target will be dead.
Because of the difference of the role they choose, $P_1 \gt P_2 \gt P_3$ always holds.
For each turn, all living players can choose one target respectively, and use their skill at the same time.
Since they fight with each other for a long time, so they know each other very much, including the hit rate of their skills. And they are intelligent enough to make the greatest choice in each turn.
You will be given the hit rate of their skills and an integer $n$, please calculate their living probability after $n$ turns of duel.
The first line contains an integer $n(1\leq n\leq 10^5)$.
The second line contains $3$ integers, $A_1,A_2$ and $A_3(100\geq A_1\gt A_2\gt A_3\geq 0)$, $A_1 = P_1 \times 100$, $A_2 = P_2 \times 100$, $A_3 = P_3 \times 100$ holds.
Output $3$ lines including $1$ integer indicating the living probability of the astrologer Komorebi
, the warrior Amuzi
and the samurai lbromine
respectively.
You should output the answer modulo $10^9+7$. It can be proven that the answer can be represented as the format $\frac{P}{Q}$, you should output the integer $X$ that satisfies $X\times Q \equiv P(\bmod 10^9+7)$.
2 80 60 40
839040006 985600007 606400005