n, k = gets.split.map(&:to_i)
r, s, p = gets.split.map(&:to_i)
$points = { "r" => p, "s" => r, "p" => s }
t = gets.chomp.each_char.to_a

m = n.fdiv(k).ceil * k
t[m - 1] = t[m - 1]
ts = t.each_slice(k).to_a.transpose.each(&:compact!)

def f(t)
  sum = 0
  t.join.scan(/(.)(\1*)/) do |x, y|
    num = y.length / 2 + 1
    sum += $points[x] * num
  end
  sum
end

puts ts.inject(0) { |sum, t| sum + f(t) }
