N, K = gets.split(' ').map(&:to_i)
R, S, P = gets.split(' ').map(&:to_i)
T = gets.chomp
# r グー, s チョキ p パー
result = 0

STR_R = "r"
STR_S = "s"
STR_X = "!"

N.times do |i|

  rsp = T[i]
  if i < K || rsp != T[i-K]
    case rsp
    when STR_R
      result += P
    when STR_S
      result += R
    else
      result += S
    end
  else
    T[i] = STR_X
  end
end
puts result