Monday, July 2, 2018

GERGOVIA - Wine trading in Gergovia : Classical

#The solution in Python 3 is as follows:


while True:
t=0
w=0
if int(input()) == 0:
               break
for a in list(map(str,input().split())):
t+= int(a)
w+= abs(t)
print(w)


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!