Walk | 프로그래밍의 벗 PivotOJ
PivotOJ

Walk

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2014-15 openBOJ 7189

문제

Mart takes a walk every day and his sports watch registers the duration and speed of each segment of uniform movement of his walk. After the walk, Mart can download a log file to his computer. Find the total distance and the average speed of the walk based on this file.

입력

The first line of input contains an integer NN (1 ≤ N ≤ 10\,000) and each of the subsequent NN lines contains the following (space-separated) data about one segment:

  • the duration of the segment in minutes and seconds in the form MMmSSs, where MM is the integer number of minutes (and the minutes part is omitted for times less than a minute) and SS is the integer number of seconds (which never exceeds 59);
  • the word kiirusega;
  • the speed on this segment expressed as minutes and seconds per kilometre in the form MMmSSs/km, where MM is the integer number of minutes and SS is the integer number of seconds (which never exceeds 5959), and you may assume Mart needs at least a minute, but less than an hour, per kilometre.

You may also assume that the total of the durations of all segments does not exceed 2424 hours.

출력

The output should contain two lines

  • on the first line the total distance of the walk, rounded to metres, in the form LLm, where LL is the integer number of metres;
  • on the second line the average speed in the form VVkm/h, where VV is a real number; the output value must not differ from the correct answer by more than 0.0010.001.

예제

예제 1

입력
3
8m30s kiirusega 9m10s/km
4m10s kiirusega 8m1s/km
21s kiirusega 4m10s/km
출력
1531m
7.057km/h
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.