#include using namespace std; vector newarr(vector &orig) { vector newarr; int sz = orig.size(); for (int j = 0; j < sz; j++) { if (j + 1 < sz) { int64_t one = orig[j]; int64_t other = orig[j + 1]; newarr.push_back(one + other); } } return newarr; } int main(int argc, char *argv[]) { int N; cin >> N; vector arr(N); for (int i = 0; i < N; i++) { cin >> arr[i]; } while (arr.size() != 1) { arr = newarr(arr); } int64_t ans = arr[0] % 1000000007; cout << ans << endl; return 0; }