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>
using namespace std;
template <typename T>
void r1(T &x) {
	x = 0;
	char c(getchar());
	int f(1);
	for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
	for(; isdigit(c);c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}

const int maxn = 2e2 + 5;
const int maxm = maxn << 1;
const int mod = 998244353;
//#define mod 998244353
typedef int room[maxn];

int n, m;
int c[maxm];
int f[2][maxn][maxn][3][3];
int g[maxm][maxm];

inline void Add(int &x,int y) {
    x += y;
    x >= mod ? x -= mod : 0;
    x < 0 ? x += mod : 0;
}

signed main() {
	int i, j;
    r1(n);
    for(i = 0; i < 26; ++ i) r1(c[i]);
    for(i = 0; i <= 2; ++ i)
        for(j = 0; j <= 2; ++ j)
            f[0][(i == 1) + (j == 1)][(i == 2) + (j == 2)]
            [i][j]
            =
            (i ? 1 : 24) * (j ? 1 : 24);
    for(i = 3; i <= n; ++ i) {
        int now = i & 1, bf = now ^ 1;
        memset(f[now], 0, sizeof(f[now]));
        for(int x = 0; x <= (n) / 2 + 1; ++ x) {
            for(int y = 0; y <= (n) / 2 + 1; ++ y) {
                for(int u = 0; u < 3; ++ u) {
                    for(int v = 0; v < 3; ++ v) {
                        for(int k = 0; k < 3; ++ k) {
                            if(u == k && k) continue;
                            if(u == k) Add(f[now][x][y][v][k], 1ll * f[bf][x][y][u][v] * 23 % mod);
//                                f[now][x][y][v][k] = (f[now][x][y][v][k] + 1ll * f[bf][x][y][u][v] * 23 % mod) % mod;
                            else Add(f[now][x + (k == 1)][y + (k == 2)][v][k], 1ll * f[bf][x][y][u][v] * (k ? 1 : 24) % mod);
//                                f[now][x + (k == 1)][y + (k == 2)][v][k] = (f[now][x + (k == 1)][y + (k == 2)][v][k] + 1ll * (k ? 1 : 24) * f[bf][x][y][u][v]) % mod;
                        }
                    }
                }
            }
        }
    }
//    puts("CCC");
    for(i = (n) / 2 + 1; ~ i; -- i) {
        for(j = (n) / 2 + 1; ~ j; -- j) {
            g[i][j] = (g[i + 1][j] + g[i][j + 1] - g[i + 1][j + 1]) % mod;
            g[i][j] < 0 ? g[i][j] += mod : 0;
            for(int u = 0; u < 3; ++ u)
            for(int v = 0; v < 3; ++ v)
                Add(g[i][j], f[n & 1][i][j][u][v]);
//                g[i][j] = (g[i][j] + f[n & 1][i][j][u][v]) % mod;
        }
    }
    int ans = g[0][0];
    for(i = 0; i < 26; ++ i) ans = (ans - g[c[i] + 1][0] + mod) % mod;
    for(i = 0; i < 26; ++ i)
        for(j = i + 1; j < 26; ++ j)
            Add(ans, g[c[i] + 1][c[j] + 1]);
//            ans = (ans + g[c[i] + 1][c[j] + 1]) % mod;
    printf("%d\n", ans);
	return 0;
}