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 <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
#define dingyi int mid = l + r >> 1, ls = p << 1, rs = p << 1 | 1
#define y0 y_csyakioi_0
#define y1 y_csyakioi_1
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define per(i, x, y) for(int i = x; i >= y; --i)
#define repg(i, u) for(int i = head[u]; i; i = e[i].nxt)
inline int read(){
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ x = x * 10 + (ch ^ 48); ch = getchar(); }
	return x * f;
}
const int N = 410, mod = 998244353;
int n, c[N], sum[N][N], f[2][N][N][3][3]; 
inline void mian(){
	n = read(); rep(i, 1, 26) c[i] = read(); f[1][0][0][0][2] = 24; f[1][0][1][0][1] = f[1][1][0][0][0] = 1;
	rep(i, 0, n) rep(j, 0, n){
		if(i) rep(k, 0, 2) f[0][i][j][k][0] = (f[0][i][j][k][0] + f[1][i - 1][j][0][k]) % mod;
		if(j) rep(k, 0, 2) f[0][i][j][k][1] = (f[0][i][j][k][1] + f[1][i][j - 1][0][k]) % mod;
		rep(k, 0, 2) f[0][i][j][k][2] = (f[0][i][j][k][2] + 24ll * f[1][i][j][0][k] % mod) % mod;
	}
	rep(i, 3, n){
		int t = i & 1, t_ = i & 1 ^ 1; memset(f[t], 0, sizeof(f[t]));
		rep(j, 0, n) rep(k, 0, n){
			if(j) rep(p, 0, 2) rep(l, 1, 2) f[t][j][k][p][0] = (f[t][j][k][p][0] + f[t_][j - 1][k][l][p]) % mod;
			if(k) rep(p, 0, 2) rep(l, 0, 2) if(l != 1) f[t][j][k][p][1] = (f[t][j][k][p][1] + f[t_][j][k - 1][l][p]) % mod;
			rep(p, 0, 2) rep(l, 0, 2) f[t][j][k][p][2] = (f[t][j][k][p][2] + 1ll * f[t_][j][k][l][p] * (24 - (l == 2)) % mod) % mod; 
		}
	} 
	rep(i, 0, n) rep(j, 0, n) rep(k, 0, 2) rep(p, 0, 2) sum[i][j] = (sum[i][j] + f[n & 1][i][j][k][p]) % mod;
	per(i, n, 0) per(j, n, 0) sum[i][j] = (((sum[i][j] + sum[i][j + 1]) % mod + sum[i + 1][j]) % mod - sum[i + 1][j + 1] + mod) % mod;
	int ans = sum[0][0]; rep(i, 1, 26) ans = (ans - sum[c[i] + 1][0] + mod) % mod;
	rep(i, 1, 25) rep(j, i + 1, 26) ans = (ans + sum[c[i] + 1][c[j] + 1]) % mod; printf("%d\n", ans);
}
int main(){ int qwq = 1; while(qwq--) mian(); return 0; }
/*
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
*/