N = int(input()) input_list = [] for i in range(N): n = input() comp = n.split() if len(comp) == 3: break else: input_list.append(int(n)) if len(input_list) == 3: sums = [sum(input_list[:2]),sum(input_list[1:3]),input_list[0]+input_list[-1]] sums.sort() print(sums[1]) else: print('assert')