import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val n = sc.nextInt

  val vl = List.fill(n)(sc.nextInt)
  val cl = List.fill(n)(sc.nextInt)

  val reg = s"%0${n}d"

  val res =
    (0 to (Math.pow(2,n) -1 ).toInt).foldLeft(0){case (max,k) =>
//      println(s"k.toBinaryString = ${k.toBinaryString}")
      val kBin =
        if(n < 20) reg.format(k.toBinaryString.toLong)
        else k.toBinaryString

      val sum = kBin.zipWithIndex.map{case (ch,i) => if(ch == '1') vl(i) - cl(i) else 0}.sum
      Math.max(max,sum)
    }

  println(res)
}
