spoj#ATMCMXNG. Richie Rich and Keen Bean

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 conatin 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:
1
3
40 60 20
Output:
2400