ATMCMXNG - Richie Rich and Keen Bean

Dr. Keen Bean has great love for chemistry. He has 100 elements with atomic number from 0-99. Dr. Kean Bean wants to react(mix) all elements together. At each turn he mix two elements together placed next to each other and replace the resulting element in their place. When mixing two elements with atomic number a and b, the resulting element atomic number will get modified and will be (a + b) % 100. The dangerous point is while mixing two elements there is production of toxic gas, whose toxicity level is a * b.

Dr. Keen Bean would like to produce very less amount of toxic gas. So he wants you to help him find minimum amount of toxic gas he can produce when mixing all elements together.

Input

The first line of input contains integerĀ  N (1 <= N <= 100), the number of elements. The second line will contain atomic numbers between 0-99. The initial atomic numbers of elements.

Output

Output the minimum amount of toxic gas Dr. Keen bean can produce.

Example

Input:
3
40 60 20

Output:
2400

Added by:dynamicgreedy
Date:2018-07-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2018-07-06 02:57:48
Kindly enable submissions.
2018-07-04 12:57:56
yep, please enable it.
2018-07-04 12:08:50 Shubhojeet Chakraborty
Please enable submissions.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.