Under construction

Still being built. Things may change

Average is not Fast Enough!

Interview

Time limit1sMemory limit128 MB

Summary
Parse each team's section times in h:mm:ss form, sum them, and print the average seconds per kilometer rounded to the nearest second, or a dash if any runner was disqualified.
Level

Easy3 of 10

Topics
Implementation, String, Math, Simulation
Solved
No attempts yet

Problem

A relay is a race for two or more teams of runners. Each member of a team runs one section of the race. Your task is to help evaluate the results of a relay race.

You have to process several teams. For each team you are given a list of running times for every section of the race, and you must compute the average time per kilometer over the whole distance.

If you enjoy the fun and challenge of competing in a contest like this, perhaps you also like a relay race. For example, there is the 'SOLA' relay in Zurich, Switzerland. For more information, visit http://www.sola.asvz.ethz.ch/ after the contest is over.

Input

The first line of the input gives the number of sections nn followed by the total distance of the relay dd in kilometers. You may assume that 1≤n≤201 \le n \le 20 and 0.0<d<200.00.0 < d < 200.0.

Each of the following lines describes one team. The team number tt (an integer, right-justified in a field of width 3) is followed by the nn results for each section, separated by a single space. Each running time is given in the format "h:mm:ss", with integer numbers for the hours, minutes and seconds. If a runner has been disqualified, the running time is denoted by "-:--:--". Each line is terminated by a newline character, and the input is terminated by EOF.

Output

For each team, output exactly one line. Print the team number tt right-aligned in a field of width 3, followed by a colon and a space, and then the team's average time per kilometer rounded to whole seconds. If at least one of the team's runners has been disqualified, output "-" instead of the average time.

The average time is the sum of all section times in seconds divided by the total distance dd, rounded to the nearest whole second (a tie of exactly 0.5 seconds is rounded up). For a team that finishes, the line has the form "{t}: {m}:{ss} min/km", where the minutes m are printed with no leading zero and the seconds ss are printed with two digits. For a disqualified team, the line has the form "{t}: -".

Examples3

  1. Example 1

    Input
    2 12.5
      5 0:23:21 0:25:01
     42 0:23:32 -:--:--
      7 0:33:20 0:41:35
    
    Expected output
      5: 3:52 min/km
     42: -
      7: 6:00 min/km
    
  2. Example 2

    Input
    1 1.0
      1 0:01:00
    
    Expected output
      1: 1:00 min/km
    
  3. Example 3

    Input
    1 2.0
      2 0:01:00
    
    Expected output
      2: 0:30 min/km