function main(input) {
  var N = input[0].split(" ")[0]-0;
  var K = input[0].split(" ")[1]-0;
  var R = input[1].split(" ")[0]-0;
  var S = input[1].split(" ")[1]-0;
  var P = input[1].split(" ")[2]-0;
  var line = input[2].split("");
  var sum = 0;
  var ngmap = {
    r:0, s:0, p:0,
  };
  line.forEach((v,i)=>{
    if(v=="r") sum += P;
    else if(v=="s") sum += R;
    else sum += S;
    if(v==line[i-K]){
      line[i] = "x";
      ngmap[v]++;
    }
  });
  console.log(sum-ngmap.r*P-ngmap.s*R-ngmap.p*S);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').split("\n"))
