#include using namespace std::literals::string_literals; using i64 = long long; using std::cout; using std::endl; using std::cin; const int MOD = 1e9 + 7; int main() { int n; scanf("%d", &n); std::vector a(n); for(int i = 0; i < n; i++) scanf("%d", &a[i]); while(a.size() > 1) { std::vector b(a.size() - 1); for(int i = 0; i < b.size(); i++) b[i] = (a[i] + a[i + 1]) % MOD; a.swap(b); } printf("%d\n", a[0]); return 0; }