N, = map(int, input().split()) X = list(map(int, input().split())) for i in range(N-1): for j in range(N-1-i): X[j] = X[j]+X[j+1] print(X[0]%(10**9+7))