#include <stdio.h>


int main()
{
  int x,y,z;
  FILE * myFile[30];
  int count[30];
  double max[30],avg[30],min[30];
  char buf[5];
  int totalCount;
  double totalMax, totalAvg, totalMin;

  for (x = 0; x< 30; x++)
  {
    sprintf(buf, "./part1out/%d", x);    
    myFile[x] = fopen(buf, "r");
  }
  for (x = 0; x < 1000; x++)
  {
    totalCount = 0;
    totalMax = 0;
    totalMin = 0;
    totalAvg = 0;
    for (y=0; y<30;y++)
    {
      fscanf(myFile[y], "%d%lf%lf%lf", &count[y], &max[y], &avg[y], &min[y]);
      totalCount += count[y];
      totalMax += max[y];
      totalAvg += avg[y];
      totalMin += min[y];
//      printf("%d\t%lf\t%lf\t%lf\n", count, max, avg, min);
    }
    printf("%d\t%lf\t%lf\t%lf\n", (int)totalCount/30, totalMax/30, totalAvg/30, totalMin/30);
  }



  for (x = 0; x< 30; x++)
  {
    fclose(myFile[x]);
  }
  return 0;
}
