n = int(input()) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 def f(A): n = len(A) if n == 1: return A B = [0] * (n - 1) for i in range(n - 1): B[i] = A[i] + A[i + 1] B[i] %= MOD return B for i in range(n - 1): A = f(A) print(A[0])