numeros = map(int,input().split(" "))
num1, num2, soma = 0, 0, 0

for i in numeros:
    if(num1 == 0):
        num1 = i
    else:
        if(i > 0):
            num2 = i
            break

for i in range(num2):
    soma += num1
    num1 += 1
    
print("{}".format(soma))
6e2d2c10e9a92220016df25277589995f51c62c8
<mask token>

<mask token>
for i in numeros:
    if num1 == 0:
        num1 = i
    elif i > 0:
        num2 = i
        break
for i in range(num2):
    soma += num1
    num1 += 1
print('{}'.format(soma))

numeros = map(int, input().split(' '))
num1, num2, soma = 0, 0, 0
for i in numeros:
    if num1 == 0:
        num1 = i
    elif i > 0:
        num2 = i
        break
for i in range(num2):
    soma += num1
    num1 += 1
print('{}'.format(soma))

numeros = map(int,input().split(" "))
num1, num2, soma = 0, 0, 0

for i in numeros:
    if(num1 == 0):
        num1 = i
    else:
        if(i > 0):
            num2 = i
            break

for i in range(num2):
    soma += num1
    num1 += 1
    
print("{}".format(soma))