0.6 It is the future, and all plant life on Earth is extinc. Fortunately, some specimens are preserved in geodesic domes attached to a spaceship called Valley Forge. The unique inhabitant of the spaceship is the drone Dewey, who takes care of the plants.
Every dome has a unique code made up of uppercase letters. All the codes have the same length. Given two codes and , define . Dewey visits the domes in a probabilistic way. Let Dewey be at dome . Every noon, Dewey decides to stay in with probability . Otherwise, Dewey choses a new domeΒ with probability proportional to .
For example, suppose that the codes are AE,
BB, CE and DG, and that Dewey is
currently at AE. Since
,
and
,
with sum 11, Dewey stays at AE with probability
,
and goes to BB, CE and DG with
probabilities
,
and
,
respectively.
0.4
Millions of days have passed, and an alien spaceship meets Valley Forge. For every dome, what is the probability that Dewey is there? Assume that Dewey moves from one dome to another in just a few minutes, that Dewey began at the dome with the smallest alphabetical code in the morning, and that the alien spaceship arrives on the evening of the -th day after Dewey started taking care of the plants (for instance, would mean the very same day, so the probability that Dewey is at the initial dome would be ). Curiously, is exactly the -th prime number.
Input consists of several cases, each one with the number of domes followed by its codes: strings made up of only uppercase letters, all different and with the same length. You can assume .
For every case, print with four digits after the decimal point the probability that Dewey is at each dome when the aliens arrive. The input cases have no precision issues.
Input
4 AE BB CE DG 2 A B 5 KEY NEW ICE BYE MAP
Output
0.2200 0.3000 0.1800 0.3000 0.5000 0.5000 0.1710 0.1691 0.1746 0.3199 0.1654