#include //sort,二分探索,など #include //popcount #include //固定長bit集合 #include //pow,logなど #include //複素数 #include //両端アクセスのキュー #include //ファイルストリーム(標準入力変更用) #include //sortのgreater #include //setprecision(浮動小数点の出力の誤差) #include //入出力 #include //集合演算(積集合,和集合,差集合など) #include //map(辞書) #include //iota(整数列の生成),gcdとlcm(c++17) #include //キュー #include //集合 #include //スタック #include //文字列 #include //イテレータあるけど順序保持しないmap #include //イテレータあるけど順序保持しないset #include //pair #include //可変長配列 //#include //using namespace atcoder; //名前 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef map msi; typedef map msll; typedef pair pii; typedef pair pllll; typedef vector vi; typedef vector vll; typedef vector vs; typedef vector vb; typedef vector> vvi; typedef vector> vvll; typedef vector> vvs; typedef vector> vvb; //定数 const ll MOD = 1000000007; const ll INF = 1000000000000000000; const double EPS = 1e-10; const int MAXR = 100000; //10^5:配列の最大のrange //マクロ #define rep(i,n) for(int i=0;i=0;i--) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define in1(x1) cin >> x1 #define in2(x1, x2) cin >> x1 >> x2 #define in3(x1, x2, x3) cin >> x1 >> x2 >> x3 #define in4(x1, x2, x3, x4) cin >> x1 >> x2 >> x3 >> x4 #define in5(x1, x2, x3, x4, x5) cin >> x1 >> x2 >> x3 >> x4 >> x5 #define in6(x1, x2, x3, x4, x5, x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6 #define inN(x, N) rep(i, N) in1(x[i]) #define outl(x) cout << x << endl #define out2l(x, y) cout << x << " " << y << endl #define out3l(x1, x2, x3) cout << x1 << " " << x2 << " " << x3 << endl #define out4l(x1, x2, x3, x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << endl #define outList(x) for(auto y : x) cout << y << " ";cout << endl //よく使う関数 template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } inline ll div_ceil(ll a, ll b) { return (a + (b - 1)) / b; } inline string zeropad(int n, int m) { ostringstream sout; sout << setfill('0') << setw(m) << n; return sout.str(); } inline int sgn(const double a) { return (a < -EPS ? -1 : (a > EPS ? +1 : 0)); } //a > 0ならば+1, a == 0ならば0, a < 0ならば-1 を返す。 基本的にEPS込みの評価はこれで行う。 template inline void unique(vector& v) { sort(all(v)); v.erase(unique(all(v)), v.end()); } template class modint { public: ll val = 0; //コンストラクタ modint(ll x = 0) { while (x < 0)x += mod; val = x % mod; } //コピーコンストラクタ modint(const modint& r) { val = r.val; } //算術演算子 modint operator -() { return modint(-val); } //単項 modint operator +(const modint& r) { return modint(*this) += r; } modint operator -(const modint& r) { return modint(*this) -= r; } modint operator *(const modint& r) { return modint(*this) *= r; } modint operator /(const modint& r) { return modint(*this) /= r; } //代入演算子 modint& operator +=(const modint& r) { val += r.val; if (val >= mod)val -= mod; return *this; } modint& operator -=(const modint& r) { if (val < r.val)val += mod; val -= r.val; return *this; } modint& operator *=(const modint& r) { val = val * r.val % mod; return *this; } modint& operator /=(const modint& r) { ll a = r.val, b = mod, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % mod; if (val < 0)val += mod; return *this; } //等価比較演算子 bool operator ==(const modint& r) { return this->val == r.val; } bool operator <(const modint& r) { return this->val < r.val; } bool operator !=(const modint& r) { return this->val != r.val; } }; using mint = modint; //入出力ストリーム istream& operator >>(istream& is, mint& x) {//xにconst付けない ll t; is >> t; x = t; return (is); } ostream& operator <<(ostream& os, const mint& x) { return os << x.val; } //累乗 mint modpow(const mint& a, ll n) { if (n == 0)return 1; mint t = modpow(a, n / 2); t = t * t; if (n & 1)t = t * a; return t; } //二項係数の計算 mint fac[MAXR + 1], finv[MAXR + 1], inv[MAXR + 1]; //テーブルの作成 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; repse(i, 2, MAXR) { fac[i] = fac[i - 1] * mint(i); inv[i] = -inv[MOD % i] * mint(MOD / i); finv[i] = finv[i - 1] * inv[i]; } } //演算部分 mint COM(ll n, ll k) { if (n < k)return 0; if (n < 0 || k < 0)return 0; return fac[n] * finv[k] * finv[n - k]; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //標準入力をファイルに変更 //std::ifstream in("input.txt"); //std::cin.rdbuf(in.rdbuf()); int N; in1(N); int M = 9; vi c(M); inN(c, M); COMinit(); mint P = 0; rep(i, N) P += modpow(10, i); mint T = 1; ll tmp = N; rep(i, N) { T *= COM(tmp, c[i]); tmp -= c[i]; } mint ans = 0; rrep(i, M) { mint N2 = N; ans += ((T * c[i]) / mint(N)) * P * (i + 1); } outl(ans); return 0; }