object Main {
  import scala.io.StdIn.readLine

  def input[A](change: String => A) = readLine.split(" ").map(change(_))
  def main(args: Array[String]): Unit = {
    val nk = input(_.toInt)
    val rsp = input(_.toInt)
    val str = readLine
    val qd = new QD(nk(0), nk(1), rsp(0), rsp(1), rsp(2))
    println(qd.ans(str))
  }
}

class QD(n: Int, k: Int, r: Long, s: Long, p: Long) {
  def take(l: (List[Char], List[Char]), i: Int):(List[Char], List[Char]) = {
    if(i == 0) {
      (l._1, l._2.reverse)
    } else {
      take((l._1.tail, l._1.head :: l._2), i - 1)
    }
  }

  def judge(c: Char):Long = {
    if(c.equals('r')) {
      this.p
    } else if(c.equals('s')) {
      this.r
    } else if(c.equals('p')) {
      this.s
    } else {
      0
    }
  }

  def ans(str: String): Long = {
    val (b,a) = take((str.toList, "".toList), this.k)
    val aPoint = a.foldLeft(0L)((acc, cur) =>
      acc + judge(cur)
    )
    b.foldLeft((a, aPoint))((acc, cur) => {
      if(acc._1.head.equals(cur)) {
        (acc._1.tail :+ '_', acc._2)
      } else {
        (acc._1.tail :+ cur, acc._2 + judge(cur))
      }
    })._2
  }
}
