import Data.List
import Data.Array

main = do
  n:k:_ <- map read . words <$> getLine :: IO [Int]
  r:s:p:_ <- map read . words <$> getLine :: IO [Integer]
  t <- getLine :: IO String
  putStrLn $ show $ score [r, s, p] k n t

foldlState :: (c -> a -> b -> (c, a)) -> c -> a -> [b] -> a
foldlState f s a l = snd $ foldl (\(s,a) -> f s a) (s, a) l

score :: [Integer] -> Int -> Int -> String -> Integer
score rsp k n t = foldlState step (-1, 3) 0 $ sortBy myCompare $ zip [ mod i k | i <- [0..n-1] ] $ map foo t
    where foo 'r' = 2
          foo 's' = 0
          foo 'p' = 1
          step prev a cur = if prev == cur
                            then ((fst prev, 3), a)
                            else (cur, a + (rsp !! snd cur))

myCompare x y
    | fst x < fst y = LT
    | fst x > fst y = GT
    | otherwise = EQ
