409346: GYM103486 M Sequence

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Sequencetime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Chiang has a magic sequence which consists of $$$n$$$ integers, but she doesn't understand the subtelty of the sequence, like the average, mode, variance, range value...

Her teammate tells her the interesting value of a sequence is the product of range value and sequence length. Now she is staring at this sequence wondering its interesting value. Chiang has learned a lot of knowledge so she wants to share some with you:

  • $$$c$$$ is the product of $$$a$$$ and $$$b$$$ if and only if $$$c = a \times b$$$.
  • Range value is the difference between the maximum and the minimum of the sequence.
Input

The first line of the input contains a single integer $$$n(1 \le n \le 10000)$$$ indicating the number of integers.

Next line contains $$$n$$$ integers $$$A_1, A_2, \ldots, A_n$$$ which refers to the sequence ($$$-100000 \le A_i \le 100000$$$).

Output

A single integer refers to the interesting value of the sequence.

ExampleInput
4
3 -1 2 4
Output
20

加入题单

上一题 下一题 算法标签: