Average and Mode

Interview

Time limit1sMemory limit128 MB

Summary
Given ten natural numbers, compute and print their average and the most frequently occurring value.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

Ten natural numbers are given. The average is the sum of the given numbers divided by the number of values, and the mode is the value that appears most often.

For instance, the average of 10, 40, 30, 60, 30, 20, 60, 30, 40, 50 is (10 + 40 + 30 + 60 + 30 + 20 + 60 + 30 + 40 + 50) / 10 = 37. In these values, 30 appears three times, more than any other value, so the mode is 30.

Given ten natural numbers, compute their average and mode.

Input

From the first line through the tenth line, one natural number is given per line. Each number is a multiple of 10 and is less than 1,000.

Output

Print the average on the first line. Print the mode on the second line.

If there is more than one mode, print any one of them. Both the average and the mode are natural numbers.

Examples1

  1. Example 1

    Input
    10
    40
    30
    60
    30
    20
    60
    30
    40
    50
    
    Expected output
    37
    30