import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (sortBy)
import Data.Function (on)

main :: IO ()
main = do
  (x : y : a : b : c : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  ps <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  qs <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  rs <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    ss = sortBy (flip compare `on` fst) $ map (flip (,) T) rs ++ map (flip (,) R) ps ++ map (flip (,) G) qs :: [(Int, RGT)]
    f :: [(Int, RGT)] -> (Int, Int, Int, Int)
    f = foldl step (x + y, x, y, 0)
      where
        step acc@(0, _, _, t) _ = acc
        step acc@(l, 0, g, t) (_, R) = acc
        step acc@(l, r, 0, t) (_, G) = acc
        step (l, r, g, t) (s, color) | color == T = (pred l, r, g, t + s)
                                     | color == R = (pred l, pred r, g, t + s)
                                     | otherwise  = (pred l, r, pred g, t + s)
    (_, _, _, total) = f ss
  print total

data RGT = R | G | T deriving Eq

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