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(3)
#include <bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define LL long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
const int MOD=998244353;
int n,c[30];
LL dp[2][410][410][2][2][2][2];
inline int min(const int&x,const int&y){return x<y?x:y;}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	scanf("%d",&n);
	for(register int i=0;i<26;i++)scanf("%d",c+i);
	int cur=0,nxt=1;
	for(register int a=0;a<2;a++)for(register int b=0;b<2;b++)
		for(register int c=0;c<2;c++)for(register int d=0;d<2;d++)
			dp[cur][n+1][n+1][a][b][c][d]=1;
	for(register int t=n-1;t>=0;t--){
		for(register int i=0;i<n+2;i++)for(register int j=0;j<n+2;j++)
			for(register int a=0;a<2;a++)for(register int b=0;b<2;b++)
				for(register int c=0;c<2;c++)for(register int d=0;d<2;d++){
					LL&res=dp[nxt][i][j][a][b][c][d];
					res=(24-(!a&&!c&&t>=2))*dp[cur][i][j][b][0][d][0];
					if(!a)res+=dp[cur][min(i+1,n+1)][j][b][1][d][0];
					if(!c)res+=dp[cur][i][min(j+1,n+1)][b][0][d][1];
					res%=MOD;
				}
		swap(cur,nxt);
	}
	LL ans=dp[cur][n+1][n+1][0][0][0][0];
	for(int i=0;i<26;i++)ans-=dp[cur][n-c[i]][n+1][0][0][0][0];
	for(int i=0;i<26;i++)for(int j=0;j<i;j++)
		ans+=dp[cur][n-c[i]][n-c[j]][0][0][0][0];
	printf("%lld\n",(ans%MOD+MOD)%MOD);
	return 0;
}
//stane stane stane