#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Customer
{
int arrive_time, cost_time;
};
bool cmp(const Customer &a, const Customer &b)
{
return a.arrive_time < b.arrive_time;
}
int char2int(char c[])
{
int hh = (c[0] - '0') * 10 + c[1] - '0';
int mm = (c[3] - '0') * 10 + c[4] - '0';
int ss = (c[6] - '0') * 10 + c[7] - '0';
return hh * 3600 + mm * 60 + ss;
}
int main()
{
int n, k;
cin >> n >> k;
vector<int> end(k, 8 * 3600);
vector<Customer> vc;
char arr[10];
int arrive, time;
Customer temp;
for (int i = 0; i < n; i++)
{
/*scanf("%s, %d", arr, &time);*/
cin >> arr >> time;
arrive = char2int(arr);
if (arrive <= 17 * 3600)
{
temp.arrive_time = arrive;
temp.cost_time = time * 60;
vc.push_back(temp);
}
}
sort(vc.begin(), vc.end(), cmp);
int wait_time, total_wait = 0;
int early;
int index;
bool nowait;
for (auto it = vc.begin(); it != vc.end(); ++it)
{
wait_time = 0;
early = 0x7fffffff;
nowait = false;
for (int i = 0; i < k; i++)
{
if (end[i] <= (*it).arrive_time)
{
end[i] = (*it).arrive_time + (*it).cost_time;
nowait = true;
break;
}
else
{
if (end[i] < early)
{
early = end[i];
index = i;
}
}
}
if (!nowait)
{
wait_time = end[index] - (*it).arrive_time;
end[index] = end[index] + (*it).cost_time;
}
total_wait += wait_time;
}
printf("%.1lf\n", total_wait / vc.size() / 60.0);
}