object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt()
    val k = sc.nextInt()
    val rPoint = sc.nextInt()
    val sPoint = sc.nextInt()
    val pPoint = sc.nextInt()
    val stringT = sc.next().toCharArray.map {
      case "r" => 0
      case "s" => 1
      case "t" => 2
    }

    val last = Array.fill(k)(-1)

    val result = Array.fill(3)(0)

    stringT.zipWithIndex.foreach { current =>
    val lastIndex = current._2 % k
      if (last(lastIndex) == current._1) {
        last(lastIndex) = -1
      } else {
        result(current._1) += 1
      }
    }
    
    val resultValue = result(0) * rPoint + result(1) * sPoint + result(2) * pPoint

    println(resultValue.toString)
  }
}
