n = int(eval(input()))

value = list(map(int, input().split()))

cost = list(map(int, input().split()))

ret = 0

for state in range((1 << n)):

    values = costs = 0

    for shift in range(n):

        if (state >> shift) & 1 == 1:

            values += value[shift]

            costs += cost[shift]

    ret = max(ret, values - costs)

print(ret)
n = int(eval(input()))

v = list(map(int, input().split()))

c = list(map(int, input().split()))

print((sum(max(v[i] - c[i], 0) for i in range(n))))
n = int(eval(input()))
value = list(map(int, input().split()))
cost = list(map(int, input().split()))
ret = 0
for state in range((1 << n)):
    values = costs = 0
    for shift in range(n):
        if (state >> shift) & 1 == 1:
            values += value[shift]
            costs += cost[shift]
    ret = max(ret, values - costs)
print(ret)

n = int(eval(input()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print((sum(max(v[i] - c[i], 0) for i in range(n))))

-value = list(map(int, input().split())) -cost = list(map(int, input().split())) -ret = 0 -for state in range((1 << n)): -    values = costs = 0 -    for shift in range(n): -        if (state >> shift) & 1 == 1: -            values += value[shift] -            costs += cost[shift] -    ret = max(ret, values - costs) -print(ret) +v = list(map(int, input().split())) +c = list(map(int, input().split())) +print((sum(max(v[i] - c[i], 0) for i in range(n))))