n,k,r,s,p,t=$<.read.split
n,k,r,s,p = [n,k,r,s,p].map(&:to_i)

ret = 0
n.times do |i|
  if i-k < 0 || t[i-k] != t[i]
    ret += case t[i]
    when 'r' then p
    when 's' then r
    when 'p' then s
    end
  else
    t[i] = '-'
  end
end

p ret
