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

arr = Array.new(k).map{Array.new}
ans = 0
for i in 0..k-1
  j = i
  str = ""
  while j < n
    if str != t[j]
      if t[j] == "r"
        ans += p
      elsif t[j] == "s"
        ans += r
      else
        ans += s
      end
    end
    str = (str == t[j]) ? "" : t[j]
    j += k
  end
end

p ans