from itertools import combinations

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

best = 0
for zac in range(N-P+1):
    moves = D[zac:zac+P]
    for err in range(K+1):
        for perr in combinations( range(P), err ):
            act_moves = moves[:]
            for x in perr:
                act_moves[x] *= -1
            best = max( best, abs(sum(act_moves)) )

print(best)
