CF86D Powerful array
Description
An array of positive integers $ a_{1},a_{2},...,a_{n} $ is given. Let us consider its arbitrary subarray $ a_{l},a_{l+1}...,a_{r} $ , where $ 1
Input Format
N/A
Output Format
N/A
Explanation/Hint
Consider the following array (see the second sample) and its \[2, 7\] subarray (elements of the subarray are colored):
 Then $ K_{1}=3 $ , $ K_{2}=2 $ , $ K_{3}=1 $ , so the power is equal to $ 3^{2}·1+2^{2}·2+1^{2}·3=20 $ .