/**
 * ProcessCourses.java
 * 
 * Reads a space-delimited text file containing lines of
 * enrollment data that look like this:
 *
 *   cs111 90 100 120 115 140 170 130 135 125
 *
 * and outputs the average enrollment for each course.
 */

import java.util.*;  // needed for Scanner
import java.io.*;    // needed for File

public class ProcessCourses {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner console = new Scanner(System.in);
        
        System.out.print("Name of the file: ");
        String filename = console.nextLine();
        
        Scanner input = new Scanner(new File(filename));
        
        while (input.hasNextLine()) {
            String record = input.nextLine();
            String[] fields = record.split(" ");
            String course = fields[0];
            
            int total = 0;
            for (int i = 1; i < fields.length; i++) {
                total += Integer.parseInt(fields[i]);
            }
            
            double avg = (double)total/(fields.length - 1);
            System.out.println(course + " " + avg);
        }
    }               
}