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?
String = input()
result = ''
for char in String:
    if char == '0' or char == '1':
        result += char
    elif char == 'B':
        result = result[:-1]
print(result)

input_str = int(input())
result = 0



## result = (input_str * (input_str+1))//2
for i in range(1, input_str+1):
    result += i
print(result)
