solve :: String -> Int -> String
solve array diff = concat $ map (\s -> solveImpl array diff s) [0..(diff-1)]

count :: String -> Char -> Int
count array c = foldl (\acc x -> if x == c then acc + 1  else acc) 0 array

-- https://atcoder.jp/contests/abc149/submissions/9288192

main = do
    [n, k] <- map read . words <$> getLine
    [r, s, p] <- map read . words <$> getLine
    line <- getLine
    let ans = solve line k
    let countR = count ans 'r'
    let countS = count ans 's'
    let countP = count ans 'p'
    putStrLn $ show (p*countR+r*countS+s*countP)
