#include<bits/stdc++.h>
using namespace std;
struct Node{
int start;
int time;
};
bool cmp(Node a,Node b){
return a.start<b.start;
}
const int INF=1000000000;
int main()
{
freopen("in.txt","r",stdin);
int n,w;cin>>n>>w;
vector<Node> ppp;
for(int i=0;i<n;i++){
int h=0,m=0,s=0,t=0;scanf("%d:%d:%d %d",&h,&m,&s,&t);
if(t*60>3600){
t=3600;
}else{
t=t*60;
}
if(h*3600+m*60+s>17*3600) continue;
else{
Node temp;
temp.time=t;temp.start=h*3600+m*60+s;
ppp.push_back(temp);
}
}
sort(ppp.begin(),ppp.end(),cmp);
int endtime=17*3600;
int starttime=8*3600;
int wendtime[w];
fill(wendtime,wendtime+w,8*3600);
int ans=0;
for(int i=0;i<ppp.size();i++){
int temp=-1;int minendtime=INF;
for(int j=0;j<w;j++){
if(wendtime[j]<minendtime){
minendtime=wendtime[j];
temp=j;
}
}
if(ppp[i].start>=wendtime[temp]){
wendtime[temp]=ppp[i].start+ppp[i].time;
}else{
ans+=(wendtime[temp]-ppp[i].start);
wendtime[temp]=wendtime[temp]+ppp[i].time;
}
}
double t=ans*1.0/60.0/(ppp.size()*1.0);
if(ppp.size()==0) printf("0.0");
else printf("%.1lf\n",t);
return 0;
}