1total = 0
2while True:
3 s = input().split()
4 if not s: # break if the string is empty
5 break
6 # two inputs are distributed in cm and num in string data type
7 cm, num = map(str, s)
8
9 if cm == 'D':
10 total += int(num)
11 if cm == 'W':
12 total -= int(num)
13
14print(total)