from itertools import combinations

N, P, K = [ int(_) for _ in input().split() ]
# assert K == 0
D = []
for n in range(N):
    smer, vzd = input().split()
    D.append( int(vzd) * (1 if smer=='V' else -1) )

S = [0]*(N+1)
for n in range(N): S[n+1] = S[n] + D[n]

print( max( abs( S[n+P] - S[n] ) for n in range(0, N-P+1) ) )
