// This file is a "Hello, world!" in D language by DMD for wandbox.
import std.algorithm, std.conv, std.stdio, std.array, std.math, std.string;

void main()
{
  const N = readln.chomp.to!long;
  const V = readln.split.map!(to!long).array;
  const C = readln.split.map!(to!long).array;

  long ans;
  foreach (b; 0..2.pow(N)) {
    long X, Y;
    foreach (n; 0..N) {
      if (!(b >> n & 1)) continue;
      X += V[n];
      Y += C[n];
    }
    const temp = X - Y;
    if (ans < temp) ans = temp;
  }
  ans.writeln;
}

// DMD reference:
//   https://dlang.org/dmd-linux.html

// D language references:
//   https://dlang.org
//   http://www.kmonos.net/alang/d/ ( Japanese )
