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

point = {'r' => p, 's' => r, 'p' => s}
flags = Array.new(k,nil)

ans = 0
n.times do |i|
  if flags[i%k] == t[i]
    flags[i%k] = nil
  else
    ans += point[t[i]]
    flags[i%k] = t[i]
  end
end

puts(ans)