solve [_] [] = 0
solve (a0:a1:as) (b:bs) | (a0 + a1) < b = (a0 + a1) + solve (a1:as) bs
                        | otherwise = b + solve (a1:as) bs

main = do
    n <- readLn :: IO Int
    as <- map read . words <$> getLine :: IO [Int]
    bs <- map read . words <$> getLine :: IO [Int]
    print $ solve as bs

