N = int(input()) V = input().rstrip().split(" ") v = [] for i in range(N): v[i] = int(V[i]) value = [0] * N value[1] = v[0] for i in range(2,N): value[i] = max(value[i-1],value[i - 2] + v[i-1]) print(value)