n = int(input()) a = list(map(int,input().split())) if len(a) > 1: print('"assert"') else: b = int(input()) c = int(input()) a.extend([b,c]) tot = set() for i in range(3): for j in range(i + 1,3): tot.add(a[i] + a[j]) tot = sorted(list(tot)) print(tot[-2])