mod = 10**9 + 7 N = int(input()) A = list(map(int, input().split())) while len(A) > 1: A = [a+b for a,b in zip(A, A[1:])] print(A[0]%mod)