N=int(input()) p=[int(a) for a in input().split()] while len(p)>1: p=[a+b for a,b in zip(p,p[1:])] print(p[0]%1000000007)