# a = int(input(""))
# b = []
# c= []
# for i in range(a):
#
#     b.append(int(input("")))
# c.append(b[0])
#
#
#
# for i in range(1,a):
#     if i ==2:
#         c.append(max(b[2] + b[1], b[2] + b[0]))
#     elif i == 1:
#         c.append(b[0] + b[1])
#     else:
#         c.append(max(b[i]+b[i-1]+c[i-3],b[i]+c[i-2]))
# print(c[a-1])