// D - Prediction and Restriction
#include <bits/stdc++.h>
using namespace std;

int main(){
	int ans=0,N,K,R,S,P; string T;
	cin>>N>>K>>R>>S>>P>>T;
	for(int k=0; k<K; k++)
		for(int i=k; i<N; i+=K)
			if(i>=K && T[i-K]==T[i]) T[i] = '-';
			else ans += T[i]=='r'?P:T[i]=='s'?R:S;
	cout<< ans <<endl;
}