SABBIRGAME  Sabbir and Game
Sabbir is a little boy. he loves to play. One day his friend taskin suggested a new interesting game. there are n levels in the game. one should pass all the levels with a positive lifepoint. in some level one can increase his lifepoint by defeating the villain of the game or lose some lifepoint when one can't defeat the villain. Sabbir knows the points he is going to lose or increase in each level. determine the mnimum lifepoint sabbir should have initially ( at the starting of the game ) to pass all the levels with a positive life point.
Input
input consists of at most 100 test cases.
first line consists of a single integer T ( 1 <= T <= 100) number of test cases
each test case is consists of two lines. first line consists of an integer n ( 1 <= n <= 1000 )
second line consists of n space separated integer a_{1 }, a_{2 }..... a_{n1 }, a_{n }( 10^{7}^{ }<= a_{i }<= 10^{7}^{ })_{ }
Output
for each test case print an integer in one line , the minimum lifepoint sabbir will need initially.
Example
Input: 3
3
5 8 3
4
1 2 3 5
3
1 0 3
Output:
4
1
0
explanation:
first case, if sabbir have 4 lifepoints at first. sabbir will have 9 points after playing 1st level, he will have 1 point after playing 2nd level, he will have 4 points after playing 3rd level... his points never becomes less than 1 (remains positive) . if he start with a lower point ( less than 4) initially, he will die at the 2nd level and can't pass all the levels. so, 4 is the minimum ans.
hide comments
sanyam19:
20180104 10:10:01
used a good concept of ternary operator.... :) 

aditya_rev:
20170621 18:40:09
pls check for submission id 19654968. could u tell me where is the bug? thx before 

itissabbir:
20170430 09:27:52
@sachinverma there is a mistake in your code. I can't tell that in comments. try to find out. 

Sachin verma:
20170427 20:11:10
@sabbir will you please check my submission. I cannot understand my mistake. Thank you. 

Marcin:
20170318 22:07:28
What should be the answer for the following test case:


Somdip Sen:
20170314 11:44:17
sd_singh: what is it you need ? 

Karsten Ari Agathon:
20170307 07:28:05
I think it will be better if stated that the minimum lifepoint initially must larger or equal to 0. 

shikhars387:
20170222 21:00:36
Last edit: 20170223 19:25:01 

vengatesh15:
20170222 18:21:52
Last edit: 20170222 18:29:47 

kira28:
20170222 14:43:46
Same as http://www.spoj.com/problems/RPLC

Added by:  sabbir 
Date:  20170221 
Time limit:  0.5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 