#ifndef LOCAL #include using namespace std; #define debug(...) (void(0)) #else #include "algo/debug.h" #endif #include using mint = atcoder::modint1000000007; void solve() { int N; cin >> N; vector A(N); for(int i = 0; i < N; i++) { int a; cin >> a; A[i] = a; } int iter = N - 1; for(;iter--;) { for(int i = 0; i + 1 < N; i++) { A[i] = A[i] + A[i + 1]; } } cout << A.begin()->val() << endl; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int tt = 1; // std::cin >> tt; while (tt--) { solve(); } }