#include using namespace std; #define ll long long #define FOR(i,n,m) for(int i=(n);i<(m);i++) #define REP(i,n) for(int i=0;i<(n);i++) #define REPR(i,n) for(int i=(n);i>=0;i--) #define all(vec) vec.begin(),vec.end() using vi=vector; using vvi=vector; using vl=vector; using vvl=vector; using P=pair; using PP=pair; using vp=vector

; using vpp=vector; using vs=vector; #define fi first #define se second #define pb push_back templatebool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} templateistream&operator>>(istream&is,pair &p){is>>p.fi>>p.se;return is;} templateostream&operator<<(ostream&os,const pair &p){os<<"("<istream&operator>>(istream&is,vector &t){REP(i,t.size())is>>t[i];return is;} templateostream&operator<<(ostream&os,const vector&t){os<<"{";REP(i,t.size()){if(i)os<<",";os< struct ModInt{ int x; ModInt():x(0){} ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){} ModInt &operator+=(const ModInt &p){ if((x+=p.x)>=mod)x-=mod; return *this; } ModInt &operator-=(const ModInt &p){ if((x+=mod-p.x)>=mod)x-=mod; return *this; } ModInt &operator*=(const ModInt &p){ x=(int)(1LL*x*p.x%mod); return *this; } ModInt &operator/=(const ModInt &p){ *this*=p.inverse(); return *this; } ModInt operator-()const{return ModInt(-x);} ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;} ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;} ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;} ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;} bool operator==(const ModInt &p)const{return x==p.x;} bool operator!=(const ModInt &p)const{return x!=p.x;} ModInt inverse()const{ int a=x,b=mod,u=1,v=0,t; while(b>0){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return ModInt(u); } friend ostream &operator<<(ostream &os,const ModInt &p){ return os<>(istream &is,ModInt &a){ long long x; is>>x; a=ModInt(x); return (is); } }; template struct Combination{ using mint=ModInt; vector fact; Combination(int n){ n++; fact.resize(n); for(int i=0;i; int main(){ int n; cin>>n; mint ans=0; Combination C(n); REP(i,n){ mint t; cin>>t; ans+=t*C.C(n-1,i); } cout<