#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; constexpr ll MOD = 1e9 + 7; rep(_, n - 1) { vector b(a.size() - 1); rep(i, b.size()) b[i] = (a[i] + a[i + 1]) % MOD; swap(a, b); Debug(a); } cout << a[0] << endl; return 0; }