#include // #include // #define RANGE_1(e) (boost::irange(0,(e))) // #define RANGE_2(s,e) (boost::irange((s),(e))) // #define RANGE_3(s,e,step) (boost::irange((s),(e),(step))) // #define RANGE_SELECTER(_1,_2,_3,SELECT,...) SELECT // #define range(...) RANGE_SELECTER(__VA_ARGS__, RANGE_3, RANGE_2, RANGE_1) (__VA_ARGS__) #define guard(x) if(x); #define CINS(x) for(auto&& AJNAD:(x))cin>>AJNAD #define ALL(x) (x).begin(),(x).end() #define RALL(x) (x).rbegin(),(x).rend() #define CALL(x) (x).cbegin(),(x).cend() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x)) #define BIT(n) (1LL<<(n)) #define MOD 1000000007 using namespace std; using lint = long long; templateclass irange{private:struct I{T x;T operator*(){return x;}bool operator!=(I&lhs){return xclass srange{private:struct I{T x,s;T operator*(){return x;}bool operator!=(I&lhs){if(s<(T)0)return x>lhs.x;return xirangerange(T n){return irange(0,n);}templateirangerange(T i,T n){return irange(i,n);}templatesrangerange(T i,T n,T s){return srange(i,n,s);} templatebool amax(T &a,const T &b){if(abool amin(T &a,const T &b){if(a>b){a=b;return true;}return false;} template struct modint { lint val; constexpr modint(lint v = 0)noexcept:val(v%M){if(val<0)val+=M;} constexpr int getM(){return M;} constexpr modint operator-()const noexcept{return val?M-val:0;} constexpr modint operator+(const modint& r)const noexcept{return modint(*this)+=r;} constexpr modint operator-(const modint& r)const noexcept{return modint(*this)-=r;} constexpr modint operator*(const modint& r)const noexcept{return modint(*this)*=r;} constexpr modint operator/(const modint& r)const noexcept{return modint(*this)/=r;} constexpr modint& operator+=(const modint& r)noexcept{val+=r.val;if(val>=M)val-=M;return *this;} constexpr modint& operator-=(const modint& r)noexcept{val-=r.val;if(val<0)val+=M;return *this;} constexpr modint& operator*=(const modint& r)noexcept{val=val*r.val%M;return *this;} constexpr modint& operator/=(const modint& r)noexcept{lint a=r.val,b=M,u=1,v=0;while(b){lint t=a/b;a-=t*b;swap(a,b);u-=t*v;swap(u,v);}val=val*u%M;if(val<0)val+=M;return *this;} constexpr bool operator==(const modint& r)const noexcept{return this->val==r.val;} constexpr bool operator!=(const modint& r)const noexcept {return this->val!=r.val;} friend constexpr istream& operator>>(istream &input,modint& x)noexcept{return input>>x.val;} friend constexpr ostream& operator<<(ostream &os,const modint& x)noexcept{return os< Mpow(const modint &a,lint n)noexcept{if(n == 0)return 1;auto t=Mpow(a,n/2);t=t*t;if(n&1)t=t*a;return t;} }; struct initialize{initialize(){cin.tie(nullptr);ios::sync_with_stdio(false);};}init; using mint = modint; int main(){ /* Code Area */ int n; cin >> n; vector a(n); CINS(a); for (int i : range(n - 1)) { vector a1(n - i - 1); for (int j : range(n - i - 1)) { a1[j] = a[j] + a[j + 1]; } a = a1; } cout << a[0] << endl; }