function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let N = parseInt(input[0][0], 10);
	let K = parseInt(input[0][1], 10);
	let R = parseInt(input[1][0], 10);
	let S = parseInt(input[1][1], 10);
	let P = parseInt(input[1][2], 10);
	let T = input[2][0];
	
	let v_k = Array.from({length: K}, () => []);
	for (let i = 0; i <= K - 1; i++){
		for (let j = 0; j <= (N - 1 - i) / K; j++){
			v_k[i].push(T[i + j*K]);
		}
	}

	let tmp;
	let ans = 0;
	for (let x of v_k){
		tmp = 1;
		for (let i = 1; i < x.length; i++){
			if (x[i] === x[i - 1]){
				tmp ++;
			} else {
				if (x[i - 1] === 'r') ans += Math.ceil(tmp / 2) * P;
				else if (x[i - 1] === 's') ans += Math.ceil(tmp / 2) * R;
				else ans += Math.ceil(tmp / 2) * S;
				tmp = 1;
			}
		}
		if (x[x.length - 1] === 'r') ans += Math.ceil(tmp / 2) * P;
		else if (x[x.length - 1] === 's') ans += Math.ceil(tmp / 2) * R;
		else ans += Math.ceil(tmp / 2) * S;
	}

	console.log(ans);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
