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

arr = {}

ts.each_with_index{ |t,i|
	ind = i % k
	
	if arr[ind] == nil then
		arr[ind] = []
	end
	
	arr[ind] << t
}

point = 0

arr.each{ |k,v|
	before = nil
	v.each{ |t|
		if before == t then
			before = nil
		else
			before = t
			if t == 'r' then
				point += p
			elsif t == 's' then
				point += r
			else
				point += s
			end
		end
	}
}

puts point