import Control.Applicative
import Control.Monad
import Data.List
import Data.Array

main = do
  n <- (read::String -> Int) <$> getLine
  values <- array (1, n) . zip [1..n] . map (read::String -> Int) . words <$> getLine
  costs <- array (1, n) . zip [1..n] . map (read::String -> Int) . words <$> getLine
  let results = calc n values costs
  print $ maximum results
 

calc::Int -> Array Int Int -> Array Int Int -> [Int]
calc n values costs = do
  set <- filterM (const [True, False]) [1..n]
  let vsum = foldl (\acc i -> acc + values ! i) 0 set
      csum = foldl (\acc i -> acc + costs ! i) 0 set
  return $ vsum - csum
