#include<bits/stdc++.h>
using namespace std;
struct Customers {
int arrived;
int need;
int wait;
};
int counter_time[10] = {0};
int counter_serve[10] = {0};
int main() {
vector<Customers> customers;
int n, k;
cin>>n;
for(int i = 0; i < n; i++) {
Customers t;
cin>>t.arrived>>t.need;
if(t.need>60) t.need = 60;
customers.push_back(t);
}
cin>>k;
for(int i = 0; i < n; i++)
{
int choose = 0;
for (int j = 0; j < k; j++)
{
if (counter_time[choose] > counter_time[j])
choose = j;
if (customers[i].arrived >= counter_time[choose])
break;
}
if (customers[i].arrived >= counter_time[choose])
{
counter_time[choose] = customers[i].arrived + customers[i].need;
customers[i].wait = 0;
}
else
{
customers[i].wait = counter_time[choose] - customers[i].arrived;
counter_time[choose] += customers[i].need;
}
counter_serve[choose]++;
}
double sum = 0;
double longest_wait = 0;
double longest_complete = 0;
for(int i = 0; i < n; i++) {
sum += customers[i].wait;
if(customers[i].wait > longest_wait) longest_wait = customers[i].wait;
}
for(int i = 0; i < k; i++) {
if(counter_time[i] > longest_complete) longest_complete = counter_time[i];
}
printf("%.1lf ",sum/n);
cout<<longest_wait<<" "<<longest_complete<<endl;
for(int i = 0; i < k; i++) {
if(i != 0) cout<<" ";
cout<<counter_serve[i];
}
}