#include using namespace std; int main() { int N, M = 1e9+7; cin >> N; vector A(N); for (int i = 0; i < N; i++) cin >> A.at(i); while (A.size() > 1) { vector tmp; for (int i = 0; i + 1 < A.size(); i++) { tmp.push_back((A.at(i) + A.at(i + 1)) % M); } A = tmp; } cout << A.at(0) << "\n"; }