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

ret = 0
i = 0
while i < k
  case t[i]
  when 'r' then ret += p
  when 's' then ret += r
  when 'p' then ret += s
  end
  i += 1
end

while i < t.length
  if t[i-k] != t[i]
    case t[i]
    when 'r' then ret += p
    when 's' then ret += r
    when 'p' then ret += s
    end
  else
    t[i] = '-'
  end
  i += 1
end

p ret
