func_code_string: #include <bits/stdc++.h>   #define LL long long   #define PII pair<int, int>   #define PLL pair<LL, LL>   #define all_of(v) (v).begin(), (v).end()   #define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))   #define fi first   #define se second   const int MAXN = 401;   //const LL INF = (LL) 1e9 + 8763;   //const LL MOD = (LL) 1e9 + 7;   using namespace std;   const LL MOD = 998244353;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      LL n, cnt[26], dall[MAXN], dp1[MAXN][MAXN][2], dp2[2][MAXN][MAXN][3], have[MAXN];      void solve() {    cin >> n;    for (int i = 0; i < 26; i++) {     cin >> cnt[i];    }        int a = n / 2, b = n - a;    for (int i = 1; i <= n; i++) {     have[i] = 1;    }    have[a] = have[n] = 0;        // [pos][used 0][used 1][last]    dall[1] = 1;    dp1[1][1][0] = 1;    dp1[1][0][1] = 1;    dp2[1][0][0][2] = 1;    dp2[1][0][1][1] = 1;    dp2[1][1][0][0] = 1;        // 2    for (int i = 2; i <= n; i++) {     for (int u0 = 0; u0 <= i; u0++) {      for (int u1 = 0; u1 <= i; u1++) {       for (int last = 0; last < 3; last++) {        LL &now = dp2[i % 2][u0][u1][last];        now = 0;        if (last == 0 && u0 == 0) continue;        if (last == 1 && u1 == 0) continue;        if (!have[i - 1] || last != 0) {         now = (now + dp2[(i - 1) % 2][u0 - (last == 0)][u1 - (last == 1)][0]) % MOD;        }        if (!have[i - 1] || last != 1) {         now = (now + dp2[(i - 1) % 2][u0 - (last == 0)][u1 - (last == 1)][1]) % MOD;        }        LL coe = 23 + (!have[i - 1] || last != 2);        now = (now + dp2[(i - 1) % 2][u0 - (last == 0)][u1 - (last == 1)][2] * coe) % MOD;       }      }     }    }    // 1    for (int i = 2; i <= n; i++) {     for (int u0 = 0; u0 <= i; u0++) {      for (int last = 0; last < 2; last++) {       if (last == 0 && u0 == 0) continue;       LL &now = dp1[i][u0][last];       if (!have[i - 1] || last != 0) {        now = (now + dp1[i - 1][u0 - (last == 0)][0]) % MOD;       }       LL coe = 24 + (!have[i - 1] || last != 1);       now = (now + dp1[i - 1][u0 - (last == 0)][1] * coe) % MOD;      }     }    }    // 0    for (int i = 2; i <= n; i++) {     LL coe = 25 + !have[i - 1];     dall[i] = (dall[i - 1] * coe) % MOD;    }        LL tot = dall[n] * 26 % MOD;    for (int t0 = 0; t0 < 26; t0++) {     for (int u0 = cnt[t0] + 1; u0 <= n; u0++) {      tot = (tot - dp1[n][u0][0] - dp1[n][u0][1] * 25) % MOD;     }    }    for (int t0 = 0; t0 < 26; t0++) {     for (int t1 = t0 + 1; t1 < 26; t1++) {      for (int u0 = cnt[t0] + 1; u0 <= n; u0++) {       for (int u1 = cnt[t1] + 1; u1 <= n; u1++) {        tot = (tot + dp2[n % 2][u0][u1][0] + dp2[n % 2][u0][u1][1] + dp2[n % 2][u0][u1][2] * 24) % MOD;       }      }     }    }        cout << (tot % MOD + MOD) % MOD <<   n ;   }      int main() {    ios_base::sync_with_stdio(0); cin.tie(0);       int tc = 1;   // cin >> tc;    for (int i = 1; i <= tc; i++) {     solve();    }       return 0;   } 