/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/* libnum {{{*/
void amax(N, Args...)(ref N x, Args y) {
  x = x.max(y);
}
void amin(N, Args...)(ref N x, Args y) {
  x = x.min(y);
}
auto maxE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amax(y);
  return x;
}
auto minE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amin(y);
  return x;
}
/*}}}*/


/+---test
5 2
8 7 6
rsrpr
---+/
/+---test
7 1
100 10 1
ssssppr
---+/
/+---test
30 5
325 234 123
rspsspspsrpspsppprpsprpssprpsr
---+/

void main(string[] args) {
  long N, K;
  readf(" %d %d ", &N, &K);
  long R, S, P;
  readf(" %d %d %d ", &R, &S, &P);
  const T = readln.chomp;

  auto scores = new long[](N);
  foreach (i, t; T) {
    scores[i] =
      t == 'r'? P:
      t == 's'? R:
      t == 'p'? S: 0;
  }

  foreach (i; K..N) {
    if (scores[i] == scores[i-K]) scores[i] = 0;
  }
  scores.sum.writeln;
}
