Under construction

Still being built. Things may change

Pareto

Time limit1sMemory limit64 MB

Summary
Choose k accounts maximizing B minus A, where A = 100k/N and B is their share of all money as a percent.
Level

Medium5 of 10

Topics
Greedy, Sorting, Math, Prefix sum
Solved
No attempts yet

Problem

Pareto's principle, also known as the "80/20 rule", states that in many situations 80% of results come from 20% of (the most important) causes. For instance, Microsoft found that by fixing 20% of the most commonly reported bugs, they would eliminate 80% of downtime in their systems. In the business world, it is often said that 80% of income comes from 20% of the most important clients. In mobile games with free basic functionality, 50% of profit comes from 0.5% of players. Some say that 80% of your success will come from 20% of your activities.

It is a known fact that 80% of the world's goods is owned by 20% of (the richest) people. Your task is to check the validity of this rule based on the bank accounts of the clients of a single bank. Is it true that 20% of accounts hold 80% of the total money? Does a stronger claim hold, for instance, that only 10% of accounts hold 85% of the total money?

More precisely: given the account balances of NN bank clients, find numbers AA and BB with the maximal difference B−AB - A such that we can say that precisely AA% of accounts hold BB% of the total money of all clients of the bank.

If you pick kk accounts (1≤k≤N1 \le k \le N), then A=100k/NA = 100k / N, and BB is the sum of the chosen balances divided by the sum of all balances, times 100. If several account counts kk give the maximal B−AB - A, choose the smallest such kk.

For example, with two accounts holding 100 and 200 euros, 50% of accounts (one account, the one with 200 euros) hold two thirds, 66.666667%, of the total money.

Input

The first line contains the integer NN (1≤N≤300 0001 \le N \le 300\,000), the number of clients in the bank.

The second line contains NN integers, the balances of the bank accounts in euros. Each balance is between 00 and 100 000 000100\,000\,000 inclusive, and at least one balance is positive.

Output

Print AA on the first line and BB on the second line, without the percentage sign.

Round both values to exactly six digits after the decimal point. When the remaining part is exactly one half, round up. For example, 0.19531250.1953125 is printed as 0.195313.

Examples2

  1. Example 1

    Input
    2
    100 200
    
    Expected output
    50.000000
    66.666667
    
  2. Example 2

    Input
    8
    100100 10 100 1000 1 10100 90100 100100
    
    Expected output
    37.500000
    96.281728