Problem: You have c_1 letters 'a', c_2 letters 'b', ..., c_{26} letters 'z'. You want to build a beautiful string of length n from them (obviously, you cannot use the i-th letter more than c_i times). Each c_i is greater than n/3.

A string is called beautiful if there are no palindromic contiguous substrings of odd length greater than 1 in it. For example, the string "abacaba" is not beautiful, it has several palindromic substrings of odd length greater than 1 (for example, "aca"). Another example: the string "abcaa" is beautiful.

Calculate the number of different strings you can build, and print the answer modulo 998244353.

Input

The first line contains one integer n (3 ≤ n ≤ 400).

The second line contains 26 integers c_1, c_2, ..., c_{26} (n/3 < c_i ≤ n).

Output

Print one integer — the number of strings you can build, taken modulo 998244353.

Examples

Input


4
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2


Output


422500


Input


3
2 2 2 2 2 2 3 3 3 2 2 2 2 2 2 3 3 3 2 2 3 2 2 3 2 2


Output


16900


Input


400
348 322 247 158 209 134 151 267 268 176 214 379 372 291 388 135 147 304 169 149 193 351 380 368 181 340


Output


287489790

Solution (in CPP):

Solution:
#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb emplace_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 400+5;
const int ha = 998244353;
int n,c[26];
int f[2][MAXN][MAXN][3][3];
int g[2][MAXN][2][2],pw[MAXN];
int F[MAXN][MAXN],G[MAXN];
// 0=a 1=b 2=oth

inline void add(int &x,int y){
    x += y-ha;x += x>>31&ha;
}

int main(){
    pw[0] = 1;FOR(i,1,MAXN-1) pw[i] = 25ll*pw[i-1]%ha;
    scanf("%d",&n);
    FOR(i,0,25) scanf("%d",c+i);
    int now = 0;
    f[now][0][0][2][2] = 24*24;
    f[now][1][0][2][0] = f[now][1][0][0][2] = 24;
    f[now][0][1][2][1] = f[now][0][1][1][2] = 24;
    f[now][1][1][0][1] = f[now][1][1][1][0] = 1;
    f[now][2][0][0][0] = f[now][0][2][1][1] = 1;
    FOR(i,3,n){
        CLR(f[now^1],0);
        FOR(a,0,n){
            FOR(b,0,n){
                FOR(c,0,2){
                    FOR(d,0,2){
                        // cd?
                        int gx = f[now][a][b][c][d];
                        if(!gx) continue;
                        if(c != 0) add(f[now^1][a+1][b][d][0],gx);
                        if(c != 1) add(f[now^1][a][b+1][d][1],gx);
                        add(f[now^1][a][b][d][2],1ll*gx*(c==2?23:24)%ha);
                    }
                }
            }
        }
        now ^= 1;
    }
    FOR(i,0,n) FOR(j,0,n) FOR(x,0,2) FOR(y,0,2) add(F[i][j],f[now][i][j][x][y]);
    ROF(i,n,0) ROF(j,n,1) add(F[i][j],F[i+1][j]),add(F[i][j],F[i][j+1]),add(F[i][j],ha-F[i+1][j+1]);
    now = 0;
    g[now][0][1][1] = 25*25;
    g[now][1][0][1] = g[now][1][1][0] = 25;
    g[now][2][0][0] = 1;
    FOR(i,3,n){
        CLR(g[now^1],0);
        FOR(a,0,n){
            FOR(c,0,1){
                FOR(d,0,1){
                    int gx = g[now][a][c][d];
                    if(!gx) continue;
                    if(c != 0) add(g[now^1][a+1][d][0],gx);
                    add(g[now^1][a][d][1],1ll*gx*(c==1?24:25)%ha);
                }
            }
        }
        now ^= 1;
    }
//    DEBUG(g[now][3][0][1]);
    FOR(i,0,n) FOR(x,0,1) FOR(y,0,1) add(G[i],g[now][i][x][y]);
    ROF(i,n,0) add(G[i],G[i+1]);
    auto calc = [&](int n){
        return 26ll*pw[n-1]%ha;
    };
    int ans = 1ll*calc(n/2)*calc((n+1)/2)%ha;
    FOR(i,0,25) add(ans,ha-G[c[i]+1]);
    FOR(i,0,25) FOR(j,i+1,25) add(ans,F[c[i]+1][c[j]+1]);
    printf("%d\n",ans);
    return 0;
}