import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val v = in.readLine.split(" ").map(_.toInt)
  val c = in.readLine.split(" ").map(_.toInt)

  def dfsEnum(d:Int, n:Int):Int = {
    // d進 n個列挙
    val enum = Array.ofDim[Boolean](n)
    var ret = 0
  
    def evalute():Unit = {
      if(!terms) return
      var resv = 0
      var resc = 0
      for(i <- 0 until n) {
        if(enum(i)) {
          resv += v(i)
          resc += c(i)
        }
      }
      ret = ret max resv - resc
    }
  
    def dfs(cnt:Int):Unit = {
      if(cnt == n) evalute
      else {
        for(i <- 0 until d) {
          enum(cnt) = true
          dfs(cnt+1)
          enum(cnt) = false
          dfs(cnt+1)
        }
      }
    }
  
    dfs(0)
    ret
  }

  val ans = dfsEnum(2,n)
  println(ans)
}