Ideal Contest#2266

Ideal Contest

3 seconds
256 megabytes
Medium

It's a pity that there is no higher-order contest for ACM ICPC regionals and subregionals; probably this is because it's very hard to rank them. But now we have an idea how to do this! The idea is based on a notion of negidealness — a number showing non-conformity of the contest results with "ideal" contest criteria. It is a weighted sum of the following specific negidealnesses (penalties).

Vainness penalty . Each team should solve at least one problem. If a team solves no problems, a penalty of (where is the number of teams that participated in the contest) for each such team is added.

Oversimplification penalty . There should be no team with all the problems solved. If some teams solve all the problems, a penalty of is added for each such team.

Evenness penalty . The number of problems solved by different teams should increase evenly. If the difference in problems solved between two adjacent (in the standings) teams is greater than , then a penalty of (where is the total number of problems) is added for each skipped number of problems solved. For example, if a team solves problems, and the next team solves problem, then a penalty of should be added, since no team solved , , or problems.

Unsolvability penalty . Every problem should be solved by at least one team. If a problem is not solved, a penalty of for each such problem is added.

Instability penalties I_1, I_2, , I_P. If a problem was solved by a team, then this problem should be solved by all the teams ranked above. For each team which did not solve problem ranked above the lowest-ranked team that did solve problem , a penalty of is added to I_p.

The total negidealness equals

1.03V + 3.141O + 2.171E + 1.414U + \frac{I_1 + I_2 + \ldots + I_P}{P}

Write a program that finds the negidealness of the given results table.

Input

The input file contains a contest results table in plain ASCII. The only whitespace symbol in the table is a space. There is always at least one space separating columns. The problems are named with capital English letters in alphabetical order. There are at most problems and at most teams.

Output

The output data should contain the penalties for each criterion (values , , , , I_1, , I_P) and the total negidealness. All the real numbers should be precise up to 3 digits after the decimal point.

Examples

Example 1

Loading
Loading