#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(vector<int> arr) {
    int result = arr[0];
    for (auto a: arr) {
        result = gcd(a, result);
    }
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


int dx[5] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1};

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
ll euler_phi(ll n) {
    ll ret = n;
    for(ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            ret -= ret / i;
            while(n % i == 0) n /= i;
        }
    }
    if(n > 1) ret -= ret / n;
    return ret;
}

vector<int> table[100010];
int main() {
    int N, K; cin >> N >> K;
    int R, S, P; cin >> R >> S >> P;
    string T; cin >> T;

    for(int i=0; i<T.size(); i++){
        int num=0;
        if(T[i]=='r')
            num = 0;
        if(T[i]=='s')
            num = 1;
        if(T[i]=='p')
            num = 2;
        table[i%K].push_back(num);
    }

    ll ans=0;
    for(int i=0; i<K; i++){
        int pre=-1;
        for(int j=0; j<table[i].size(); j++) {
            if (table[i][j] == 0) {
                if (pre != 2) {
                    ans += P;
                    pre = 2;
                }else{
                    if(j+1==table[i].size())
                        break;

                    if(table[i][j+1]==0){
                        pre = 0;
                    }else if(table[i][j+1]==1){
                        pre = 1;
                    }else if(table[i][j+1]==2){
                        pre = 0;
                    }
                }




            } else if (table[i][j] == 1) {
                if (pre != 0) {
                    ans += R;
                    pre = 0;
                }else{
                    if(j+1==table[i].size())
                        break;

                    if(table[i][j+1]==0){
                        pre = 1;
                    }else if(table[i][j+1]==1){
                        pre = 1;
                    }else if(table[i][j+1]==2){
                        pre = 2;
                    }
                }




            } else {
                if (pre != 1) {
                    ans += S;
                    pre = 1;
                }else{
                    if(j+1==table[i].size())
                        break;

                    if(table[i][j+1]==0){
                        pre = 0;
                    }else if(table[i][j+1]==1){
                        pre = 2;
                    }else if(table[i][j+1]==2){
                        pre = 2;
                    }
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5440