print((-int(eval(input()))+sum(map(int,input().split()))))
eval(input());print((sum([x-1 for x in list(map(int,input().split()))])))
print((-int(eval(input())) + sum(map(int, input().split()))))

eval(input())
print((sum([x - 1 for x in list(map(int, input().split()))])))

-print((-int(eval(input())) + sum(map(int, input().split())))) +eval(input()) +print((sum([x - 1 for x in list(map(int, input().split()))])))