https://cses.fi/problemset/task/2191
Input Format
Check Link
Output Format
Check Link
Constraints
Check Link
Example
Input
4 1 1 4 2 3 5 1 4
Output
16
https://cses.fi/problemset/task/2191
Check Link
Check Link
Check Link
4 1 1 4 2 3 5 1 4
16