#include <stdio.h>

struct Student {
    int id;
    char name[50];
    int score[3];
};

void input_students(int n, struct Student students[]) {
	int i,j;
    for (i = 0; i < n; ++i) {
        scanf("%d %s %d %d %d", &students[i].id, students[i].name, 
              &students[i].score[0], &students[i].score[1], &students[i].score[2]);
    }
}

void calculate_student_average(int n, struct Student students[]) {
	int i;
    for (i = 0; i < n; ++i) {
        float average = (students[i].score[0] + students[i].score[1] + students[i].score[2]) / 3.0;
        printf("%d %s %.2f\n", students[i].id, students[i].name, average);
    }
}

void calculate_course_average(int n, struct Student students[]) {
    float sum[3] = {0};
    int i,j;
    for (i = 0; i < n; ++i) {
        for (j = 0; j < 3; ++j) {
            sum[j] += students[i].score[j];
        }
    }
    for (i = 0; i < 3; ++i) {
        float average = sum[i] / n;
        printf("%.2f ", average);
    }
    printf("\n");
}

int main() {
    int n;
    scanf("%d", &n);

    struct Student students[n];

    input_students(n, students);

    calculate_student_average(n, students);

    calculate_course_average(n, students);

    return 0;
}

