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;

#define MOD 998244353

int n, c[26];
long long dp[2][225][225][3][3], ans, wtf[225][225], ftw[225];

void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}

void sub(long long& a, long long b) {
	a += MOD - b;
	if (a >= MOD) a -= MOD;
}

int main() {
	scanf("%d", &n);
	dp[0][0][0][2][2] = 24 * 24;
	dp[0][0][1][2][1] = 24;
	dp[0][0][1][1][2] = 24;
	dp[0][1][0][2][0] = 24;
	dp[0][1][0][0][2] = 24;
	dp[0][1][1][0][1] = 1;
	dp[0][1][1][1][0] = 1;
	dp[0][0][2][1][1] = 1;
	dp[0][2][0][0][0] = 1;
	int ta = 0, tb = 1;
	for (int i = 2; i < n; i++) {
		int ma = i / 2 + 5;
		memset(dp[tb], 0, sizeof(dp[tb]));
		for (int j = 0; j <= ma; j++)
			for (int k = 0; k <= ma; k++)
				for (int kk = 0; kk < 3; kk++) {
					dp[tb][j + 1][k][kk][0] = (dp[tb][j + 1][k][kk][0] + dp[ta][j][k][1][kk] + dp[ta][j][k][2][kk]) % MOD;
					dp[tb][j][k + 1][kk][1] = (dp[tb][j][k + 1][kk][1] + dp[ta][j][k][0][kk] + dp[ta][j][k][2][kk]) % MOD;
					dp[tb][j][k][kk][2] = (dp[tb][j][k][kk][2] + (dp[ta][j][k][0][kk] + dp[ta][j][k][1][kk]) * 24 + dp[ta][j][k][2][kk] * 23) % MOD;
				}
		swap(ta, tb);
	}
	int ma = n / 2 + 5;
	for (int i = 0; i <= ma; i++)
		for (int j = 0; j <= ma; j++)
			for (int ii = 0; ii < 3; ii++)
				for (int jj = 0; jj < 3; jj++) {
					add(wtf[i][j], dp[ta][i][j][ii][jj]);
					add(ftw[i], dp[ta][i][j][ii][jj]);
				}
	ans = 26 * 26;
	for (int i = 2; i < n; i++) ans = (ans * 25) % MOD;
	for (int i = 0; i < 26; i++) scanf("%d", c + i);
	for (int i = 0; i < 26; i++)
		for (int ii = c[i] + 1; ii <= ma; ii++) {
			sub(ans, ftw[ii]);
			for (int j = i + 1; j < 26; j++) {
				for (int jj = c[j] + 1; jj <= ma; jj++)
					add(ans, wtf[ii][jj]);
			}
		}
	printf("%lld\n", ans);
}