object Main {
  def main(args:Array[String]) {
    val read1 = readLine()
    val N = read1.split(' ')(0).toInt
    val K = read1.split(' ')(1).toInt
    val read2 = readLine()
    val R = read2.split(' ')(0).toInt
    val S = read2.split(' ')(1).toInt
    val P = read2.split(' ')(2).toInt
    val T = readLine()

    var choice = List[Char]()
    for(i <- 0 until K) {
      var G = List[Char]()
      for(t <- i until T.length by K)  G = T(t) :: G
      G = G.reverse
      if(G(0) == 'r') choice = 'P' :: choice
      if(G(0) == 's') choice = 'R' :: choice
      if(G(0) == 'p') choice = 'S' :: choice
      for(j <- 1 until G.size) {
        if(choice(0) != 'P' && G(j) == 'r') choice = 'P' :: choice
        else if(choice(0) != 'R' && G(j) == 's') choice = 'R' :: choice
        else if(choice(0) != 'S' && G(j) == 'p') choice = 'S' :: choice
        else choice = 'E' :: choice
      }
    }
    var sum = 0
    for(i <- choice) {
      if(i == 'P') sum += P
      else if(i == 'R') sum += R
      else if(i == 'S') sum += S
      else sum += 0
    }
    println(sum)
  }
}

