This page is still under construction.

Parts of this page are still being built. What you see may change.

Judging Olympia

Interview

Time limit1sMemory limit128 MB

Summary
For each line of six judge grades, discard the highest and lowest and print the average of the remaining four, stopping at the all-zero line.
Level

Easy2 of 10

Topics
Implementation, Math, Array
Solved
No attempts yet

Problem

A panel of six judges evaluates each contest submission. Instead of each judge grading a single aspect, every judge assigns one overall grade out of ten, taking all six aspects into account together: correctness, robustness, overall design, clarity, coding style, and maintainability.

To keep the judging impartial, the final grade of a submission is the average of the six grades after discarding exactly two of them: the single highest grade and the single lowest grade. This way, any judge who inflates or deflates a particular team's grade risks having that grade thrown out.

Write a program that prints the final grade of a submission.

Input

The input contains one or more test cases. Each test case is a single line listing the six grades given by the judges. Each grade is an integer from 0 to 10. The input ends with a dummy test case in which all six grades are zero; this terminating line is not processed.

Output

For each test case, print the final grade on its own line. Print it without unnecessary trailing zeros or decimal points: print a whole number when the result is an integer (for example 6), and otherwise print the exact value (for example 5.5).

Examples1

  1. Example 1

    Input
    8 8 8 4 4 4
    8 8 6 4 4 3
    0 0 0 0 0 0
    
    Expected output
    6
    5.5