# import sys; input = sys.stdin.buffer.readline # sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N = int(input()) A = getlist() if sum(A) != A[0]: print('"assert"') return a2 = int(input()) A.append(a2) a3 = int(input()) A.append(a3) A.sort() if A[0] + A[2] == A[1] + A[2]: print(A[0] + A[1]) else: print(A[0] + A[2]) if __name__ == '__main__': main()