"use strict"
function main(arg) {
    var args = arg.split("\n")
    var k = args[0].split(" ").map(Number)[1]
    var rsp = args[1].split(" ").map(Number)
    var r = rsp[0]
    var s = rsp[1]
    var p = rsp[2]
    var l = args[2].split("")
    var n = l.length
    var ans = 0
    for (var i = 0; i < n; i++) {
        // console.log([l[i] + l[i+2]])
        if (i >= k) {
            if (l[i] === l[i-k]) {
                l[i] = '-'
                // console.log("-")
                continue
            }
        }
        if (l[i] === 'r') {
            // console.log('p')
            ans += p
        }
        if (l[i] === 's') {
            // console.log('r')
            ans += r
        }
        if (l[i] === 'p') {
            // console.log('s')
            ans += s
        }
        
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));