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;
typedef long long ll;
typedef vector <int> vi;
#define pb push_back
const ll MOD = 998244353;
ll ans=0,s[405][405];
vi vc;
const int N = 405;
int dp[2][N][N][3][3],a[N],n;
inline int getmod(int x) {return (x>=MOD) ? x-MOD : x;};
void getdp()
{
    dp[0][0][0][0][0]=1;
    for (int i=0;i<n;++i)
    {
        int now=i&1,nw=now^1;
        memset(dp[nw],0,sizeof(dp[nw]));
        for (int j1=0;j1<=i;++j1)
        for (int j2=0;j2+j1<=i;++j2)
        for (int se=0;se<3;++se)
        for (int lst=0;lst<3;++lst)
        {
            if (se!=1)
            dp[nw][j1+1][j2][lst][1]=
            getmod(dp[nw][j1+1][j2][lst][1]+dp[now][j1][j2][se][lst]);
            if (se!=2)
            dp[nw][j1][j2+1][lst][2]=
            getmod(dp[nw][j1][j2+1][lst][2]+dp[now][j1][j2][se][lst]);
            if (se!=0 || i<=1)
            dp[nw][j1][j2][lst][0]=
            (24LL*dp[now][j1][j2][se][lst]+dp[nw][j1][j2][lst][0])%MOD;
            else
            dp[nw][j1][j2][lst][0]=
            (23LL*dp[now][j1][j2][se][lst]+dp[nw][j1][j2][lst][0])%MOD;
        }
    }
    for (int j1=0;j1<=n;++j1)
    for (int j2=0;j2<=n;++j2)
    {
        for (int se=0;se<3;++se)
        for (int lst=0;lst<3;++lst)
        {
            (s[j1][j2]+=dp[n&1][j1][j2][se][lst])%=MOD;
        }
    }
    for (int j1=n;j1>=0;--j1)
    for (int j2=n;j2>=0;--j2)
    {
        s[j1][j2]=(s[j1][j2]+s[j1+1][j2]+s[j1][j2+1]-s[j1+1][j2+1])%MOD;
    }
}
ll calc()
{
    int p1=0,p2=0;
    if (vc.size()>0) p1=a[vc[0]]+1;
    if (vc.size()>1) p2=a[vc[1]]+1;
    return s[p1][p2];
}
void dfs(int k,int cnt,int p)
{
    if (cnt>2) return;
    if (k>26)
    {
        (ans+=calc()*p)%=MOD;
        return;
    }
    dfs(k+1,cnt,p);
    vc.pb(k);
    dfs(k+1,cnt+1,-p);
    vc.pop_back();
}
int main()
{
    cin>>n;getdp();
    for (int i=1;i<=26;++i) cin>>a[i];
    dfs(1,0,1);
    ans=(ans%MOD+MOD)%MOD;
    cout<<ans<<endl;
    return 0;
}