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 <class T> inline void read(T &x) {
	x= 0;
	char c= getchar();
	while(!isdigit(c)) c= getchar();
	while(isdigit(c)) x= x * 10 + (c & 15), c= getchar();
}
const int P= 998244353;
#define N 405
int n, a[26], f[2][N][N][3][3], s[N][N], ans;
signed main() {
	read(n);
	for(int i= 0; i < 26; i++) read(a[i]);
	f[0][0][0][0][0]= 576, f[0][0][1][0][2]= f[0][0][1][2][0]= f[0][1][0][0][1]= f[0][1][0][1][0]= 24, f[0][0][2][2][2]= f[0][2][0][1][1]= f[0][1][1][1][2]= f[0][1][1][2][1]= 1;
	bool x= 1, y= 0;
	for(int i= 3; i <= n; i++) {
		for(int j= 0; j <= i; j++)
			for(int k= 0; k + j <= i; k++) {
				f[x][j][k][0][0]= (f[y][j][k][0][0] * 23ll + f[y][j][k][1][0] * 24ll + f[y][j][k][2][0] * 24ll) % P, f[x][j][k][1][0]= (f[y][j][k][0][1] * 23ll + f[y][j][k][1][1] * 24ll + f[y][j][k][2][1] * 24ll) % P, f[x][j][k][2][0]= (f[y][j][k][0][2] * 23ll + f[y][j][k][1][2] * 24ll + f[y][j][k][2][2] * 24ll) % P;
				if(j) f[x][j][k][0][1]= (f[y][j - 1][k][0][0] + f[y][j - 1][k][2][0]) % P, f[x][j][k][1][1]= (f[y][j - 1][k][0][1] + f[y][j - 1][k][2][1]) % P, f[x][j][k][2][1]= (f[y][j - 1][k][0][2] + f[y][j - 1][k][2][2]) % P;
				if(k) f[x][j][k][0][2]= (f[y][j][k - 1][0][0] + f[y][j][k - 1][1][0]) % P, f[x][j][k][1][2]= (f[y][j][k - 1][0][1] + f[y][j][k - 1][1][1]) % P, f[x][j][k][2][2]= (f[y][j][k - 1][0][2] + f[y][j][k - 1][1][2]) % P;
			}
		x^= 1, y^= 1;
	}
	for(int i= n; i >= 0; i--)
		for(int j= n - i; j >= 0; j--) s[i][j]= ((long long)s[i + 1][j] + s[i][j + 1] + P - s[i + 1][j + 1] + f[y][i][j][0][0] + f[y][i][j][0][1] + f[y][i][j][0][2] + f[y][i][j][1][0] + f[y][i][j][1][1] + f[y][i][j][1][2] + f[y][i][j][2][0] + f[y][i][j][2][1] + f[y][i][j][2][2]) % P;
	ans= s[0][0];
	for(int i= 0; i < 26; i++) {
		ans= (ans + P - s[a[i] + 1][0]) % P;
		for(int j= i + 1; j < 26; j++) ans= (ans + s[a[i] + 1][a[j] + 1]) % P;
	}
	printf("%d", ans);
	return 0;
}