#include #include #include using namespace std; using ll = long long; #include using mint = atcoder::modint1000000007; ll gcd(ll a,ll b){ if(b) return gcd(b,a%b); return a; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; vector c(10,0); for(int i = 1;i<=9;i++) cin>>c[i]; { int cnt = 0; for(int i = 1;i<=9;i++) if(c[i]!=0) cnt++; if(cnt==1){ mint ans = 0; for(int i = 1;i<=9;i++) { for(int j = 0;j=8){ ans = 1; { bool fn = true; for(int i = 1;i<=9;i++) if(i%2==1&&c[i]!=0) fn = false; if(fn) ans *= 2; } ll sum = 0; for(int i = 1;i<=9;i++) sum += i * c[i]; if(sum%9==0) ans *= 9; else if(sum%3==0) ans *= 3; cout< all; for(int i = 1;i<=9;i++) for(int j = 0;j