function Main(input) {
    input = input.split("\n");
    var n = Number(input[0].split(" ")[0]);
    var k = Number(input[0].split(" ")[1]);
    var r = Number(input[1].split(" ")[0]);
    var s = Number(input[1].split(" ")[1]);
    var p = Number(input[1].split(" ")[2]);
    var t = input[2].split(" ")[0].trim();
//    var isRNG = true;
//    var isSNG = true;
//    var isPNG = true;
    
    var results = [];
    
    for(var i=0; i<t.length; i++){
        if(i>=k && t.charAt(i) == t.charAt(i-k) && results[i-k] > 0){
            results.push(0);
            continue;
        }
        
        if(t.charAt(i) == "r"){
            results.push(p);
        }else if(t.charAt(i) == "s"){
            results.push(r);
        }else{
            results.push(s);
        }
    }
    
    var result = 0;
    for(var i=0; i<results.length; i++){
        result += results[i];
    }
    
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));