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