n = int(input()) a = [int(i) for i in input().split()] mod = 10**9+7 #print(sum(a)%mod) ans = 0 wa = [[0 for i in range(n)] for j in range(2)] for i in range(n): wa[0][i] = a[i] wa[0][i] %= mod for i in range(n-1): for j in range(n-1-i): wa[1][j] = wa[0][j]+wa[0][j+1] wa[1][j] %= mod wa[0] = wa[1] print(wa[1][0])