The election committee of Flatland is preparing a presidential election. To reduce human error during counting, the committee built an automated ballot analyzing device.
There are n candidates. A ballot has one square box for each candidate, and the voter must mark exactly one box. A ballot with no marked box, or with two or more marked boxes, is invalid. The voter feeds the ballot into the scanner inside the device, and the scanner reads the marks and produces a voting string of n characters. A marked box becomes X and an unmarked box becomes ..
Given the voting strings of every ballot, write a program that prints the counting report. Candidates are listed in decreasing order of votes. Candidates with the same number of votes keep the order they appear in on the ballot. A candidate who received p votes out of the m ballots has a result of 100p/m percent. The last line of the report gives the percentage of invalid ballots.
The first line contains the number of candidates n and the number of ballots m. (2≤n≤10, 1≤m≤1000)
Each of the next n lines contains the last name of one candidate. Each name is a string of at most 100 English letters. No candidate has the last name Invalid.
Each of the next m lines contains one voting string, made of n characters that are each X or ..
Print n+1 lines. On the first n lines, in decreasing order of votes, print the last name of the candidate, a space, the result in percent, and the percent sign %. On the last line print the word Invalid, a space, the percentage of invalid ballots, and the percent sign.
Round every number to exactly two digits after the decimal point. If a value sits exactly halfway between two such numbers, print the greater one. For example, print 12.35 for 12.345.