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 <string.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

const int mod = 998244353;
const int mxn = 402, m = 3, k = 26;
int n;
int a[k];
ll dp[mxn][mxn][m], dp2[mxn][mxn][m];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	
	for(int i = 0; i < k; i++) cin >> a[i];
	
	dp[0][0][2] = 1;
	for(int i = 0; i < n; i++){
		memcpy(dp2, dp, sizeof(dp));
		for(int j = 0; j <= n; j++)
		for(int l = 0; l <= n; l++)
		for(int x = 0; x < m; x++){
			dp[j][l][x] = 0;
			if(j >= !x && l >= !~-x) for(int y = 0; y < m; y++){
				(dp[j][l][x] += ((x == 2 ? 24 : 1) - (x == y) * 
					(i && i != n / 2)) * dp2[j - !x][l - !~-x][y]) %= mod;
			}
		}
	}
	
	for(int i = n; ~i; i--)
	for(int j = n; ~j; j--)
	for(int l = 0; l < m; l++)
	for(int x = 0; x < 2; x++)
	for(int y = !x; y < 2; y++){
		(dp[i][j][l] += mod + (2 * (x ^ y) - 1) * dp[i + x][j + y][l]) %= mod;
	}
	
	ll ret = 0;
	for(int i = 0; i < m; i++){
		(ret += dp[0][0][i]) %= mod;
		for(int j = 0; j < k; j++){
			(ret += mod - dp[a[j] + 1][0][i]) %= mod;
			for(int l = 0; l < j; l++){
				(ret += dp[a[j] + 1][a[l] + 1][i]) %= mod;
			}
		}
	}
	
	cout << ret << endl;
	
	return 0;
}