https://codeforces.com/contest/1165/problem/E
Input Format
Check Link
Output Format
Check Link
Constraints
Check Link
Example
Input
5 1 8 7 2 4 9 7 2 9 3
Output
646
https://codeforces.com/contest/1165/problem/E
Check Link
Check Link
Check Link
5 1 8 7 2 4 9 7 2 9 3
646