The Miniature Toy Association (or MTA for short) is
releasing the latest edition of its brand of collectible
figurines. MTA used to sell them individually, but now has
decided to adopt a new business strategy that involves randomly
choosing figurines
from the entire collection to be packaged and sold together as
a ‘-pack’. Each
figurine in a -pack is
chosen independently and randomly with uniform distribution. As
such, it is possible that a -pack may contain multiple copies
of a particular figurine.
Even though some figurines may be more valuable than others,
every randomly assembled -pack is sold at the same price.
Customers buying a -pack of figurines do not know
ahead of time which figurines will be inside, and so it is a
matter of chance whether they get the figurines that they want
most. While the price is the same across all -packs, the weight is not, as each
figurine has a distinct integer weight in grams.
Before MTA releases its new line of figurines, its Chief
Financial Officer (CFO) would like an executive summary with
information about the proposed -packs. Specifically, the CFO wants
to know: the greatest possible weight of a -pack, the smallest possible weight
of a -pack, the number
of distinct weights that a -pack could have, and the expected
weight of a -pack. Note
that the expected weight is the average (mean) weight across
all possible distinct -packs, where two -packs are distinct if and only if
one -pack has a
different number of figurines of any particular weight than the
other -pack. So, for
example, a -pack with
weights is
distinct from a -pack
with weights (even though they both have the same total weight).
Also, a -pack with
weights is
distinct from a 4-pack with weights .
Input
The input consists of a single test case. The first line of
the input contains a single integer , the number of different figurines
to be produced, where . The next line contains space-separated integers
representing the weight in grams of each of the figurines. Each
weight, , is an integer
satisfying , and all
weights are distinct.
Output
The output should consist of a single line with space-separated values. The first
value should be an integer, the maximum weight of a
-pack in grams for the
given set of figurines. The second value should be an integer,
the minimum weight of a -pack in grams for the given set of
figurines. The third value should be an integer, the number of
distinct weights that the -packs can have for the given set
of figurines. The fourth value should be a floating-point
value, the expected weight of a -pack in grams for the given set of
figurines, with an absolute or relative error of at most
.
Sample Input 1 |
Sample Output 1 |
4
1 2 4 7
|
28 4 21 14.0
|
Sample Input 2 |
Sample Output 2 |
3
2 5 4
|
20 8 12 14.66666667
|