package main import . "fmt" func main() { var n int Scan(&n) a:=make([]int,n) for i:=range a { Scan(&a[i]) } const m = 1e9+7 for ;n>1;n-- { for i,v:=range a[1:] { a[i]+=v a[i]%=m } } Println(a[0]) }