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

point_map = {'s' => r, 'p' => s, 'r' => p}
point = 0
seq_list = {'r' => [], 's' => [], 'p' => []}

t.each_with_index do |i, j|
  if j - k >= 0 && i == t[j - k]
    seq_list[i] << j - k
    seq_list[i] << j
  end
  point += point_map[i]
end
seq_map = {}
seq_list.each do |key, arr|
  seq_map[key] = arr.uniq.group_by {|i| i % k}
end

seq_map.each do |key, map|
  map.each do |_, arr|
    arr.sort!
    tmp = []
    idx = 0
    prev = arr[0]
    tmp[idx] = 1
    (1...arr.count).each do |i|
      current = arr[i]
      if current - prev == k
        tmp[idx] += 1
      else
        idx += 1
        tmp[idx] = 2
      end
      prev = current
    end
    tmp.each do |i|
      point -= point_map[key] * (i / 2)
    end
  end
end

puts point