from scipy.special import comb n = int(input()) lis = list(map(int,input().split())) num = 0 ans = 0 for i in range(n//2): num = comb(n,i,exact = True) ans += lis[i] * num ans += lis[-(1 + i)] * num ans %= 10 ** 9+7 if len(lis)%2:ans += lis[(n-1)//2] print(ans)