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;const int N=400+6,D=998244353;int dp[2][N][N][3][3],sum[N][N];int cnt[26];
int main(){int n;cin>>n;for(int i=0;i<26;++i)cin>>cnt[i];bool d=0;dp[d][0][0][0][0]=1;for(int tmp=1;tmp<=n;++tmp){d^=1;memset(dp[d],0,sizeof(dp[d]));
		for(int x=0;x<=tmp;++x)for(int y=0;y<=tmp-x;++y)for(int a=0;a<=2;++a)for(int b=0;b<=2;++b){int f0=dp[d^1][x][y][a][b];if(!f0)continue;
			(dp[d][x][y][b][0]+=f0*(23LL+(a!=0 || (tmp-2<=0)))%D)%=D;if(a!=1)(dp[d][x+1][y][b][1]+=f0)%=D;if(a!=2)(dp[d][x][y+1][b][2]+=f0)%=D;}}++sum[0][0]; 
	for(int i=0;i<26;++i){--sum[cnt[i]+1][0];for(int j=i+1;j<26;++j)++sum[cnt[i]+1][cnt[j]+1];}
	for(int x=0;x<=n;++x)for(int y=1;y<=n;++y)(sum[x][y]+=sum[x][y-1])%=D;for(int x=1;x<=n;++x)for(int y=0;y<=n;++y)(sum[x][y]+=sum[x-1][y])%=D;int ans=0;
	for(int x=0;x<=n;++x)for(int y=0;y<=n-x;++y)for(int a=0;a<=2;++a)for(int b=0;b<=2;++b)if(dp[d][x][y][a][b])(ans+=1LL*dp[d][x][y][a][b]*sum[x][y]%D)%=D; 
	cout<<(ans+D)%D<<endl;}