import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
for i in range(N - 1):
  for i in range(N - i - 1):
    a[i] += a[i + 1]
    a[i] %= mod
print(a[0])