#include <stdio.h>
#define SIZE 20
typedef struct{
int ArrivalTime;
int Duration;
}CustomerType;
int windows[SIZE];
int total_time;
CustomerType customers[200];
int total;
void BankOpen(){
int i;
for(i=0; i<SIZE; i++){
windows[i] = 0;
}
total_time = 0;
}
void CustomerIn(int total){
int i = 0;
while(i < total){
scanf("%d%d",&customers[i].ArrivalTime, &customers[i].Duration);
i++;
}
}
void Deals(int m, int n){
int i, j;
int minTimeIndex;
for(i=0; i<n; i++){
minTimeIndex = 0;
for(j=1 ;j<m ;j++){
if(windows[minTimeIndex] > windows[j]){
minTimeIndex = j;
}
}
if(windows[minTimeIndex] <= customers[i].ArrivalTime){
windows[minTimeIndex] = customers[i].ArrivalTime + customers[i].Duration;
}else{
total_time += windows[minTimeIndex] - customers[i].ArrivalTime;
windows[minTimeIndex] += customers[i].Duration;
}
}
}
int main(){
int m;
while(scanf("%d%d",&m ,&total) != EOF){
BankOpen();
CustomerIn(total);
Deals(m, total);
printf("%.2lf\n", total_time*1.0/total);
}
return 0;
}
/**************************************************************
Problem: 2147
User: admin
Language: C
Result: Accepted
Time:11 ms
Memory:1148 kb
****************************************************************/