def main():
vec = [1, 2, 5, -4, 5, 6, -7, 1, -1, -7, 1, -10, 1, -3, 4]
print(vec)
i = 0
n = len(vec)
p = 1
smax = 0
while i < n:
while i < n and vec[i] <= 0:
i += 1
p = i
s = 0
while i < n and vec[i] >= 0:
s += vec[i]
i += 1
if s > smax:
smax = s
pmax = p
lmax = i - p
print("Position: ",pmax)
print("Summa:", smax)
print("Length: ",lmax)
main()
ZGVmIG1haW4oKToKICAgIHZlYyA9IFsxLCAyLCA1LCAtNCwgNSwgNiwgLTcsIDEsIC0xLCAtNywgMSwgLTEwLCAxLCAtMywgNF0KICAgIHByaW50KHZlYykKICAgIGkgPSAwCiAgICBuID0gbGVuKHZlYykKICAgIHAgPSAxCiAgICBzbWF4ID0gMAogICAgd2hpbGUgaSA8IG46CiAgICAgICAgd2hpbGUgaSA8IG4gYW5kIHZlY1tpXSA8PSAwOgogICAgICAgICAgICBpICs9IDEKICAgICAgICBwID0gaQogICAgICAgIHMgPSAwCiAgICAgICAgd2hpbGUgaSA8IG4gYW5kIHZlY1tpXSA+PSAwOgogICAgICAgICAgICBzICs9IHZlY1tpXQogICAgICAgICAgICBpICs9IDEKICAgICAgICBpZiBzID4gc21heDoKICAgICAgICAgICAgc21heCA9IHMKICAgICAgICAgICAgcG1heCA9IHAKICAgICAgICAgICAgbG1heCA9IGkgLSBwCiAgICBwcmludCgiUG9zaXRpb246ICIscG1heCkKICAgIHByaW50KCJTdW1tYToiLCBzbWF4KQogICAgcHJpbnQoIkxlbmd0aDogIixsbWF4KQptYWluKCkK
[1, 2, 5, -4, 5, 6, -7, 1, -1, -7, 1, -10, 1, -3, 4]
Position: 4
Summa: 11
Length: 2