There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?
# coding: utf-8

stack = []
for i in input():
    if i=='0':
        stack.append(0)
    elif i=='1':
        stack.append(1)
    else:
        if(len(stack)>0):
            stack.pop()

stack.reverse()

while(len(stack)>0):
    print(stack.pop(), end='')
print()
n = int(input())
n = sum([x for x in range(n+1)])
print(n)