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:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define co(n) cout<<n<<endl;
const double eps=1e-10,pi=3.1415926535898;
const int mod=998244353,maxn=1e2+1;
int dp[2*maxn][maxn][maxn][3],T,n,m,x,y,p,q;
int a[30],dd[2*maxn][maxn],sd[maxn][maxn];

inline void upd(int &x) {
	if (x >= mod) x -= mod;
	return;
}

int main(int argc, char const *argv[]) {
	//init();
	T = 1;
	//scanf("%d", &T);
	for (int _=1;_<=T;++_) {
		int ans=26*26;
		scanf("%d", &n);
		m = n/2;
		n = (n+1)/2;
		for (int i=1;i<n;++i) ans = 25LL*ans%mod;
		for (int i=1;i<m;++i) ans = 25LL*ans%mod;
		x = (n+1)/2;
		p = (m+1)/2;
		for (int i=1;i<=26;++i) {
			scanf("%d", a+i);
		}
		dp[1][1][0][0] = 1;
		dp[1][0][1][1] = 1;
		dp[1][0][0][2] = 24;
		dd[1][1] = 1;
		dd[1][0] = 25;
		for (int i=2;i<2*maxn-1;++i) {
			for (int j=0;j<=(i+1)/2;++j) {
				for (int k=0;k+j<=i and k<=(i+1)/2;++k) {
					if (j) {
						dp[i][j][k][0] += dp[i-1][j-1][k][1];
						upd(dp[i][j][k][0]);
						dp[i][j][k][0] += dp[i-1][j-1][k][2];
						upd(dp[i][j][k][0]);
						dd[i][j] += dp[i-1][j-1][k][1];
						upd(dd[i][j]);
						dd[i][j] += dp[i-1][j-1][k][2];
						upd(dd[i][j]);
					}
					if (k) {
						dp[i][j][k][1] += dp[i-1][j][k-1][0];
						upd(dp[i][j][k][1]);
						dp[i][j][k][1] += dp[i-1][j][k-1][2];
						upd(dp[i][j][k][1]);
						dd[i][j] += dp[i-1][j][k-1][0];
						upd(dd[i][j]);
						dd[i][j] += dp[i-1][j][k-1][2];
						upd(dd[i][j]);
					}
					if (i>j+k) {
						dp[i][j][k][2] += 24LL*(dp[i-1][j][k][0]+dp[i-1][j][k][1])%mod;
						upd(dp[i][j][k][2]);
						dp[i][j][k][2] += 23LL*dp[i-1][j][k][2]%mod;
						upd(dp[i][j][k][2]);
						dd[i][j] += 24LL*(dp[i-1][j][k][0]+dp[i-1][j][k][1])%mod;
						upd(dd[i][j]);
						dd[i][j] += 23LL*dp[i-1][j][k][2]%mod;
						upd(dd[i][j]);
					}
				}
			}
		}
		for (int i=1;i<2*maxn-1;++i) {
			for (int j=0;j<=(i+1)/2;++j) {
				for (int k=0;k+j<=i and k<=(i+1)/2;++k) {
					dp[i][j][k][0] += dp[i][j][k][1];
					upd(dp[i][j][k][0]);
					dp[i][j][k][0] += dp[i][j][k][2];
					upd(dp[i][j][k][0]);
				}
			}
		}
		for (int i=1;i<=26;++i) {
			if (a[i] >= x+p) continue;
			for (int i1=0;i1<=x;++i1) {
				for (int i2=0;i2<=p;++i2) {
					if (i1+i2 > a[i]) {
						ans += mod-1LL*dd[n][i1]*dd[m][i2]%mod;
						upd(ans);
					}
				}
			}
		}
		for (int i=0;i<=p;++i) {
			for (int j=0;j<=p;++j) {
				sd[i][j] = dp[m][i][j][0];
			}
		}
		for (int i=p-1;i>=0;--i) {
			for (int j=p;j>=0;--j) {
				sd[i][j] += sd[i+1][j];
				upd(sd[i][j]);
			}
		}
		for (int j=p-1;j>=0;--j) {
			for (int i=p;i>=0;--i) {
				sd[i][j] += sd[i][j+1];
				upd(sd[i][j]);
			}
		}
		for (int i=1;i<=26;++i) {
			for (int j=i+1;j<=26;++j) {
				if (a[i]>=x+p or a[j]>=x+p) continue;
				for (int i1=0;i1<=x;++i1) {
					for (int j1=0;j1<=x;++j1) {
						if (a[i]-i1 >= p) continue;
						if (a[j]-j1 >= p) continue;
						ans += 1LL*dp[n][i1][j1][0]*sd[a[i]+1-i1][a[j]+1-j1]%mod;
						upd(ans);
					}
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
clock_t clk;
clk = clock();
if(clock() - clk > CLOCKS_PER_SEC * 0.9) 
      T
W     L
A C M E R
  E L   E
    E
*/