import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import qualified Data.Sequence as Seq

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)



main :: IO ()
main = do
    [n,k] <- r'
    [r,s,p] <- r'
    t <- getLine
    let nxt = drop k $ map rsp t
    print $ solve k Seq.empty t nxt (r,s,p) 0


solve :: Int -> Seq.Seq Char -> String -> String -> (Int,Int,Int) -> Int -> Int
solve _     ng     [] _    (r,s,p) ac = ac
solve count ng (t:tt) nxt  (r,s,p) ac
    | count > 0                 = solve (count-1) (ng Seq.|> rsp t) tt (stail nxt) (r,s,p)
                                    (ac +(case rsp t of 'r' -> r
                                                        's' -> s
                                                        'p' -> p))
    | Seq.index ng 0 /= rsp t   = solve count (Seq.drop 1 ng Seq.|> rsp t) tt (stail nxt) (r,s,p)
                                    (ac +(case rsp t of 'r' -> r
                                                        's' -> s
                                                        'p' -> p))
    | null nxt  = solve count (Seq.drop 1 ng Seq.|> t) tt (stail nxt) (r,s,p) ac
    | otherwise = solve count (Seq.drop 1 ng Seq.|> selNot (rsp t,head nxt) ) tt (stail nxt) (r,s,p) ac


stail [] = []
stail xs = tail xs

rsp :: Char -> Char
rsp 'r' = 'p'
rsp 's' = 'r'
rsp 'p' = 's'

selNot :: (Char,Char) -> Char
selNot t = case t of
    ('r','s') -> 'p'
    ('s','r') -> 'p'
    ('r','p') -> 's'
    ('p','r') -> 's'
    ('p','s') -> 'r'
    ('s','p') -> 'r'
    ('r','r') -> 'p'
    ('s','s') -> 'r'
    ('p','p') -> 's'


