N,K = gets.split(' ').map(&:to_i)
R,S,P = gets.split(' ').map(&:to_i)
T = gets

arrays = Array.new
K.times do
  arrays << Array.new
end

i = 0
N.times do
  arrays[i%K].push(T[i])
  i += 1
end

score = 0
arrays.each do |arr|
  arr.size.times do |i|
    if i!=0 and arr[i]==arr[i-1]
      arr[i]='x'
    else
      if arr[i]=='r'
        score += P
      elsif arr[i]=='s'
        score += R
      else
        score += S
      end
    end
  end
end

print score