N = int(eval(input()))

V = [int(i) for i in input().split()]

C = [int(i) for i in input().split()]



ans = -float('inf')

d = len(V)

for b in range(2 ** d):

    tmp = 0

    for j in range(d):

        if ((b >> j) & 1):

            tmp += V[j] - C[j]

    ans = max(ans, tmp)

print(ans)

N = int(eval(input()))

V = [int(i) for i in input().split()]

C = [int(i) for i in input().split()]



print((sum([v - c for v, c in zip(V, C) if v - c >= 0])))
N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
ans = -float("inf")
d = len(V)
for b in range(2**d):
    tmp = 0
    for j in range(d):
        if (b >> j) & 1:
            tmp += V[j] - C[j]
    ans = max(ans, tmp)
print(ans)

N = int(eval(input()))
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print((sum([v - c for v, c in zip(V, C) if v - c >= 0])))

-ans = -float("inf") -d = len(V) -for b in range(2**d): -    tmp = 0 -    for j in range(d): -        if (b >> j) & 1: -            tmp += V[j] - C[j] -    ans = max(ans, tmp) -print(ans) +print((sum([v - c for v, c in zip(V, C) if v - c >= 0])))