n, k = gets.chomp.split.map(&:to_i)
r, s, p = gets.chomp.split.map(&:to_i)
t = gets.chomp

score = { "r" => p,
          "s" => r,
          "p" => s }

res = 0
0.step(k - 1) do |i|
  c = ""
  i.step(n - 1, k) do |j|
    if j == i || c != t[j]
      c = t[j]
      res += score[t[j]]
    else
      c = ""
    end
  end
end
puts res