#include using namespace std; constexpr int MOD = 1e9 + 7; int main() { int n; cin >> n; vector a(n); for(int i = 0; i < n; ++i) cin >> a[i]; vector b(n); for(int q = 0; q < n - 1; ++q) { for(int i = 0; i < n; ++i) { b[i] = (a[i] + a[(i + 1) % n]) % MOD; } swap(a, b); } cout << a[0] << '\n'; return 0; }