import Data.Maybe

main :: IO ()
main = do
  l1 <- getLine
  l2 <- getLine
  l3 <- getLine
  let [n, k] = map read $ words l1 :: [Int]
      [r, s, p] = map read $ words l2 :: [Int]
      t = l3
  print $ fst $ foldl (f r s p k) (0, []) t

f r s p k (pt, l) a
  | w' == 'r' = (pt + r, w':l)
  | w' == 's' = (pt + s, w':l)
  | w' == 'p' = (pt + p, w':l)
  | otherwise = (pt, a:l)
  where w = fromJust (a `lookup` zip "rsp" "prs")
        w' = if length l >= k && l !! (k - 1) == w then ' ' else w