N = input() A1_wk = input() A1_list = A1_wk.split() if len(A1_list) > 1: print("assert") else: A1 = int(A1_list[0]) A2 = int(input()) A3 = int(input()) ans_list = [A1+A2 , A2+A3 , A1+A3] ans_list.sort() print(ans_list[1])