//#include #include #include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; vector fact, factinv, inv; ll gcd(ll(a), ll(b)) { ll c = a; while (a % b != 0) { c = a % b; a = b; b = c; } return b; } ll mod = 1e9 + 7; void prenCkModp(ll n) { fact.resize(n + 5); factinv.resize(n + 5); inv.resize(n + 5); fact.at(0) = fact.at(1) = 1; factinv.at(0) = factinv.at(1) = 1; inv.at(1) = 1; for (ll i = 2; i < n + 5; i++) { fact.at(i) = (fact.at(i - 1) * i) % mod; inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod; factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod; } } ll nCk(ll n, ll k) { if (n < k) return 0; return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod; } int main() { ll N; cin>>N; //prenCkModp(N); vll C(9); ll S=0; ll P=8; ll G=-1; rep(i,9){ cin>>C[i]; if(C[i]>0){ G++; if((i+1)%2!=0)P=1; else if((i+1)%4!=0)P=gcd(P,2); else if((i+1)%8!=0)P=gcd(P,4); } S+=C[i]*(i+1); } ll mod=1e9+7; if(G==0){ rep(i,9){ if(C[i]!=0){ ll k=1; ll an=0; rep(j,C[i]){ an+=k*(i+1); k*=10; k%=mod; an%=mod; } cout<