Code not working for hidden test cases

I have written this code https://ide.codingblocks.com/s/229344
It works fine for sample test-case but not passing the hidden test cases, Kindly Help to find the bug.

Hello @Akshay123,

Your approach is failing for test cases like:
1
5
-1 4 -1 -2 7
Expected Output:
10
Your Output:
11

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.