The Fair Flavor Score

A food critic club rates a new dish every day. Some reviewers are generous, others are harsh - so the chef wants to ignore the extreme ratings on both ends before averaging.

You are asked to compute the k% trimmed mean - ignore a fixed percentage of the lowest ratings and the same percentage of the highest ratings, then average what’s left.

The first line of the input contains a single integer n - the number of ratings.

The second line contains n space-separated integers - the ratings.

The third line contains an integer p - the percentage to trim from each end (in percent).

The program should drop the k% smallest and the k% largest ratings (after sorting), then print the mean of the remaining ratings. It is guaranteed that at least one rating remains after trimming.

Input

Output

7
1 2 100 3 4 5 200
20

22.8

10
2 2 3 4 6 8 10 12 100 200
10

18.125

5
1 2 3 100 200
40

3

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue