G. Max Cut Min Flow
time limit per test
1 second
memory limit per test
960 megabytes
input
standard input
output
standard output
Examples
Input
6 7
3 -1 4 1 -5
Output
15
Input
5 4
-6 -7 -6 -7
Output
-1