#include using namespace std; using ll = long long; const int mod = 1e9 + 7; int main() { int n; cin >> n; vector a(n); for(int i = 0; i < n; i++)cin >> a[i]; for(int i = 1; i < n; i++) { vector nxt(a.size() - 1); for(int j = 0; j < (int)a.size() - 1; j++)nxt[j] = ( a[j] + a[j + 1] ) % mod; a = nxt; } cout << a.front() << endl; }