'''
@Author: your name
@Date: 2020-07-10 23:17:01
@LastEditTime: 2020-07-11 01:07:21
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: \vscode_py\day5.py
'''
# Question16
# 计算奇数的平方
def Q16():
r=[]
l=input().split(',')
for i in l:
if int(i)%2!=0:
r.append(str(int(i)**2))
print(",".join(r))
# Question17
# 根据关键字来计算银行账户的余额
def Q17():
money=0
while True:
l=input().split()
print(l)
if not l:
break
cm,num=map(str,l)
if cm=="D":
money+=int(num)
if cm=='W':
money-=int(num)
print(money)
# total = 0
# while True:
# s = input().split()
# if not s: # break if the string is empty
# break
# cm,num = map(str,s) # two inputs are distributed in cm and num in string data type
# if cm=='D':
# total+=int(num)
# if cm=='W':
# total-=int(num)
# print(total)
if __name__ == "__main__":
# Q16()
Q17()