#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAX 505

int main(int argc, char* argv[])
{
    FILE *input = fopen(argv[1], "r");
    FILE *output = fopen(argv[2], "w");
    char niza[MAX];
    int brojac = 0;
    while(brojac < 3) {
        fscanf(input, "%s", niza);
        int a, b, c;
        fscanf(input, "%d%d%d", &a, &b, &c);
        if(((a + b + c) / 3) < 10) {
            fprintf(output, "%s %d\n", niza, (a + b + c) / 3);
        }
//        fprintf(output, "%s", niza);
        brojac++;
    }
    

    return 0;
}
