https://cses.fi/problemset/task/2193
Input Format
Check Link
Output Format
Check Link
Constraints
Check Link
Example
Input
4 1 1 5 3 3 5 1 4
Output
6 8
https://cses.fi/problemset/task/2193
Check Link
Check Link
Check Link
4 1 1 5 3 3 5 1 4
6 8