import numpy as np

n = int(eval(input()))

value = np.array(tuple(map(int, input().split())))

cost = np.array(tuple(map(int, input().split())))

xy = value - cost

ans = 0

for i in range(n):

    if xy[i] < 0:

        continue

    else:

        ans += xy[i]

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

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

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

# iこめまでのxーyの最大値

inf = -100

dp = [inf] * (n+1)

dp[1] = max(0, value[0]-cost[0])

for i in range(2, n+1):

    dp[i] = max(dp[i-1], dp[i-1]+value[i-1]-cost[i-1])



print((dp[n]))

import numpy as np

n = int(eval(input()))
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
xy = value - cost
ans = 0
for i in range(n):
    if xy[i] < 0:
        continue
    else:
        ans += xy[i]
print(ans)

n = int(eval(input()))
value = tuple(map(int, input().split()))
cost = tuple(map(int, input().split()))
# iこめまでのxーyの最大値
inf = -100
dp = [inf] * (n + 1)
dp[1] = max(0, value[0] - cost[0])
for i in range(2, n + 1):
    dp[i] = max(dp[i - 1], dp[i - 1] + value[i - 1] - cost[i - 1])
print((dp[n]))

-import numpy as np - -value = np.array(tuple(map(int, input().split()))) -cost = np.array(tuple(map(int, input().split()))) -xy = value - cost -ans = 0 -for i in range(n): -    if xy[i] < 0: -        continue -    else: -        ans += xy[i] -print(ans) +value = tuple(map(int, input().split())) +cost = tuple(map(int, input().split())) +# iこめまでのxーyの最大値 +inf = -100 +dp = [inf] * (n + 1) +dp[1] = max(0, value[0] - cost[0]) +for i in range(2, n + 1): +    dp[i] = max(dp[i - 1], dp[i - 1] + value[i - 1] - cost[i - 1]) +print((dp[n]))