import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, k] <- getIntList
    [r, s, p] <- getIntList
    ts <- grouping k <$> getLine
    print . sum $ map (solve r s p) ts

grouping k s = map (map snd) . groupBy g . sortBy f $ zip (cycle [1..k]) s
    where f (i, _) (j, _) = compare i j
          g (i, _) (j, _) = i == j

solve r s p ts = sum . map jan $ group ts
    where jan cs = ((length cs + 1) `div` 2) * (hand (head cs))
          hand c | c == 'r' = p
                 | c == 's' = r
                 | c == 'p' = s