// D - Prediction and Restriction
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

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