#include using namespace std; using ll = long long; ll mod = 1000000007; int main() { int N; cin >> N; vectorA(N); for(int i = 0; i < N; i++) cin >> A[i]; for(int i = 1; i < N; i++) for(int j = i; j < N-i+1; j++) { A[j-1] = A[j-1]+A[j]; A[j-1] %= mod; } cout << A[0] << endl; }