import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : k : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  (r : s : p : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    score :: Maybe RSP -> Int
    score (Just R) = r
    score (Just S) = s
    score (Just P) = p
    score _        = 0
  as <- map unsafeCharToRSP <$> getLine :: IO [RSP]
  let
    (as', as'') = splitAt k as
    bs = map (Just . suc) as' ++ map f (zip as'' bs) :: [Maybe RSP]
      where
        f :: (RSP, Maybe RSP) -> Maybe RSP
        f (a, Just b) | suc a == b = Nothing
        f (a, _)                   = Just . suc $ a
  print . sum . map score $ bs

data RSP = R | S | P deriving Eq

unsafeCharToRSP :: Char -> RSP
unsafeCharToRSP 'r' = R
unsafeCharToRSP 's' = S
unsafeCharToRSP 'p' = P

suc :: RSP -> RSP
suc R = P
suc S = R
suc P = S

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
