#include "bits/stdc++.h"
using namespace std;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
    os<<"("<<p.first<<", "<<p.second<<")";
    return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
    os<<"{";
    for(int i = 0;i < (int)v.size(); i++){
        if(i)os<<", ";
        os<<v[i];
    }
    os<<"}";
    return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define IOS ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0), cin.exceptions(cin.failbit)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
#define fill(a,b)  memset(a, b, sizeof (a))
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define pb push_back
#define int long long
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

const long long modb = 1000000007;
const long long inf = 0x3f3f3f3f3f3f3f3fLL; // Large int
const double oo = 1e15; // Large double
const double eps = 1e-8; // Small double, used for computational geometry
const double pi = acos(-1.0);

inline int gcd(int a, int b){ if (a == 0) return b; return gcd(b % a, a);}
inline int lcm(int a,int b){return (a*b)/gcd(a, b);}
inline bool isPerfectSquare(int x){ int s = sqrt(x); return (s*s == x);}
inline bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);} 

int de, xe, ye;
void extendedEuclid(int A,int B){
    if(B == 0){
        de = A;
        xe = 1;
        ye = 0;
    }else{
        extendedEuclid(B, A%B);
        int temp = xe;
        xe = ye;
        ye = temp - (A/B)*ye;
    }
}

inline int modInverse(int A, int M){ extendedEuclid(A,M); return (xe%M+M)%M;}
inline int dv(int a,int b){ return ((a%modb)*(modInverse(b,modb)%modb))%modb;}
inline int add(int a, int b) {a += b; if(a >= modb) return a - modb; return a;}
inline int sub(int a, int b) {a -= b; if(a < 0) return a + modb; return a;}
inline int mul(int a, int b) {return (int) a * b % modb;}

int pwr(int a,int b){
	a %= modb;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % modb;
        a = (a * a) % modb;
        b >>= 1;
    }
    return ans;
}

int32_t main(){
    IOS;
    int n,k,r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;cin>>t;
    int ans=0;
    int flag[sz(t)+1]={0};
    rep(i,sz(t)){
        if(i<k||t[i]!=t[i-k]||flag[i-k]==0){
            if(t[i]=='r')ans+=p;
            else if(t[i]=='s')ans+=r;
            else ans+=s;
            flag[i]=1;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1232