提示: 欢迎访问OurACM平台。
Problem 1877 MiniSum

Accept: 102    Submit: 216
Time Limit: 2000 mSec    Memory Limit : 32768 KB

Problem Description

yayamao is so clever that he would like to apply post-graduate of MIT(the Massachusetts Institute of Technology).But all the other teammates think that is impossible and daydreaming. wzc gives yayamao a simple puzzle.If yayamao can solve it quickly, wzc promises to support and help yayamao preparing materials.

The puzzle is that, wzc takes out N cards(1,…,N), each card has an integer number Li written on it.yayamao can choose a real number Xi from each card, but the real number should satisfy that |Xi| <= Li.For all choosen Xi, wzc defines a function F(X1,X2,…,XN) = Σ(Xi * Xj)(i < j) and asks yayamao to find the minimum result of the funcion F.

yayamao is stumped by this puzzle and asks you to help him.Can you quickly solve this problem?

Input

There are multiple cases ,for each case,

First line is the number of cards N (2 <= N <= 40)

Then following N numbers (L1,L2,…LN) that Li (1 <= Li <= 100) is the number written on the ith card.

There may be one or more blank lines between each input case.

Output

For each case

Output the minimum result of the function F by choosing the group of (X1,X2,…XN). which is rounded to two digits after the decimal point.

Sample Input

2 2 4 3 1 2 3

Sample Output

-8.00 -7.00

Source

code6

Submit  Back  Status  Discuss