// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

 

#define rep(i,n) for(int i=0;i<n;i++)

#define REP(i,s,n) for(int i=(s);i<(n);i++)

#define repr(i,n) for(int i=n-1;i>=0;i--)

#define REPR(i,s,n) for(int i=(s);i>=(n);i--)

#define all(a) (a).begin(),(a).end()

#define rall(a) (a).rbegin(),(a).rend()

#define Eunique(v) v.erase(unique(all(v)),v.end())

#define Eback(s) s.erase(s.end()-1,s.end())

#define pb push_back

#define pf push_front

#define mod 1000000007

#define m_p make_pair

#define DOUBLE fixed << setprecision(15)

#define OK puts("OK")

#define OK1 puts("OK1")

#define OK2 puts("OK2")

#define SIZE(s) (int)s.size()

#define Cout(n) cout<<(n)<<endl

#define INF 1000000000000000000LL



typedef vector<int> vi;

typedef vector<vi> vvi;

typedef long long ll;

typedef vector<ll> vll;

typedef vector<vll> vvll;

typedef pair<ll,ll> pll;

typedef pair<int,int> pii;

typedef vector<pair<int,int>> vpii;

typedef vector<pair<ll,ll>> vpll;

typedef vector<string> vs;

const double pi = acos(-1.0);



template<class A, class B>

ostream& operator<<(ostream& ost, const pair<A, B>&p) {

	ost << "{" << p.first << ", " << p.second << "} ";

	return ost;

}



template<class T>

ostream& operator<<(ostream& ost, const vector<T>&v) {

	ost << "{";

	for (int i = 0; i<(int)v.size(); i++) {

		if (i)ost << ", ";

		ost << v[i];

	}

	ost << "} \n";

	return ost;

}



template<class A, class B>

ostream& operator<<(ostream& ost, const map<A, B>&v) {

	ost << "{";

	for (auto p:v) {

		ost << "{" << p.first << ", " << p.second << "} ";

	}

	ost << "} ";

	return ost;

}



ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }

ll lcm(ll x, ll y) { return x * y / gcd(x, y); }



bool IsPrime(int num){

    if (num < 2) return false;

    else if (num == 2) return true;

    else if (num % 2 == 0) return false;



    double sqrtNum = sqrt(num);

    for (int i = 3; i <= sqrtNum; i += 2){

        if (num % i == 0){

            return false;

        }

    }

    return true;

}



int main()

{

	ll n,k,r,s,p,ans=0;

	string t;

	cin >> n >> k >> r >> s >> p >> t;

	vector<char> c(n);

	vll v(100001,0);

	rep(i,SIZE(t)){

		if(i+k<SIZE(t) && t[i]==t[i+k] && t[i]!='x'){

			t[i+k]='x';

		}

	}

	rep(i,SIZE(t)){

		if(t[i]=='r') ans+=p;

		else if(t[i]=='s') ans+=r;

		else if(t[i]=='p') ans+=s;

	}

	//cout << t << endl;

	cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7986188099191633x):
#include <bits/stdc++.h>

using namespace std;

 

#define rep(i,n) for(int i=0;i<n;i++)

#define REP(i,s,n) for(int i=(s);i<(n);i++)

#define repr(i,n) for(int i=n-1;i>=0;i--)

#define REPR(i,s,n) for(int i=(s);i>=(n);i--)

#define all(a) (a).begin(),(a).end()

#define rall(a) (a).rbegin(),(a).rend()

#define Eunique(v) v.erase(unique(all(v)),v.end())

#define Eback(s) s.erase(s.end()-1,s.end())

#define pb push_back

#define pf push_front

#define mod 1000000007

#define m_p make_pair

#define DOUBLE fixed << setprecision(15)

#define OK puts("OK")

#define OK1 puts("OK1")

#define OK2 puts("OK2")

#define SIZE(s) (int)s.size()

#define Cout(n) cout<<(n)<<endl

#define INF 1000000000000000000LL



typedef vector<int> vi;

typedef vector<vi> vvi;

typedef long long ll;

typedef vector<ll> vll;

typedef vector<vll> vvll;

typedef pair<ll,ll> pll;

typedef pair<int,int> pii;

typedef vector<pair<int,int>> vpii;

typedef vector<pair<ll,ll>> vpll;

typedef vector<string> vs;

const double pi = acos(-1.0);



template<class A, class B>

ostream& operator<<(ostream& ost, const pair<A, B>&p) {

	ost << "{" << p.first << ", " << p.second << "} ";

	return ost;

}



template<class T>

ostream& operator<<(ostream& ost, const vector<T>&v) {

	ost << "{";

	for (int i = 0; i<(int)v.size(); i++) {

		if (i)ost << ", ";

		ost << v[i];

	}

	ost << "} \n";

	return ost;

}



template<class A, class B>

ostream& operator<<(ostream& ost, const map<A, B>&v) {

	ost << "{";

	for (auto p:v) {

		ost << "{" << p.first << ", " << p.second << "} ";

	}

	ost << "} ";

	return ost;

}



ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }

ll lcm(ll x, ll y) { return x * y / gcd(x, y); }



bool IsPrime(int num){

    if (num < 2) return false;

    else if (num == 2) return true;

    else if (num % 2 == 0) return false;



    double sqrtNum = sqrt(num);

    for (int i = 3; i <= sqrtNum; i += 2){

        if (num % i == 0){

            return false;

        }

    }

    return true;

}



int main()

{

	ll n,k,r,s,p,ans=0;

	string t;

	cin >> n >> k >> r >> s >> p >> t;

	rep(i,SIZE(t)){

		if(i+k<SIZE(t) && t[i]==t[i+k] && t[i]!='x'){

			t[i+k]='x';

		}

	}

	rep(i,SIZE(t)){

		if(t[i]=='r') ans+=p;

		else if(t[i]=='s') ans+=r;

		else if(t[i]=='p') ans+=s;

	}

	cout << ans << endl;

	return 0;

}