let [|N; K|] = stdin.ReadLine().Split(' ') |> Array.map int
let n = N - 1
let [|R;S;P|] = stdin.ReadLine().Split(' ') |> Array.map int
let T = stdin.ReadLine().ToCharArray()
let mutable (b:bool[]) = [|for i in 0..N-1 -> false|]

let point a = 
    if a = 'r' then
            P
        else if a = 's' then
        R
        else
        S

let rec sum a = 
    if a = n 
    then point T.[a]
    else
        point T.[a] + sum (a+1)

let mutable s = sum 0
for i in K .. n do
    if T.[i - K] = T.[i] && b.[i - K] = false
        then 
            b.[i] <- true
            s <- s - point T.[i]

s |> printfn "%d"