L. Letter Lottery
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output
One of the codes keeping a robot under control at the NWERC.

Robots have been serving humanity well for quite some time, and in the last few years, LLMs also became quite useful. What could possibly go wrong when combining them? Well... the worst science fiction scenarios almost became reality. Fortunately, the world's brightest minds managed to find a set of $$$n$$$ codes that got the robots under control.

To celebrate the survival of humanity, a Near-World-Ending Robotics Carnival (NWERC) is organized. While most people would not dare to go near the machines that nearly destroyed humanity, Lara is an artificial intelligence enthusiast and would love to attend the carnival. However, normal tickets are already sold out, and her last chance is to get a ticket by participating in the Balancing Access to Phenomenal Carnivals (BAPC) raffle.

To enter the BAPC raffle, Lara has picked a single lowercase letter from the English alphabet. To determine which letter wins the raffle and hence who get a ticket for NWERC, the organizers first draw one of the $$$n$$$ codes (consisting of English lowercase letters) uniformly at random, and then independently draw one of the letters from the selected code uniformly at random. Fortunately, the codes have been published, making it possible to calculate which letter is most likely to be chosen in this two-stage process. You know that Lara has picked a letter that maximizes her chances of winning. Given this, what is the probability that Lara will get a ticket for NWERC?

Input

The input consists of:

  • One line with an integer $$$n$$$ ($$$1\leq n\leq {1000}$$$), the number of codes.
  • $$$n$$$ lines, each with a string $$$b$$$ ($$$1\leq |b|\leq {1000}$$$), the letters in each code.
The tickets only consist of English lowercase letters (a-z).
Output

Output the probability of the letter that maximizes Lara's chances of winning.

Your answer should have an absolute error of at most $$$10^{-6}$$$.

Examples
Input
5
abcdef
aaabbbccc
bbccdd
bdffhhii
xyz
Output
0.191666667
Input
1
abcdefghijklmnopqrstuvwxyz
Output
0.03846154
Input
1
a
Output
1