N = int(input()) A = [int(i) for i in input().split()] D = 10 ** 9 + 7 from scipy.special import comb result = 0 for i, ai in enumerate(A): result += ai * comb(N - 1, i, exact=True) % D print(result % D)