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<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60 ;
constexpr ll mod=998244353 ;

ll dp2[2][444][444][3][3], dp1[444][444][2][2], dp[444];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    dp[2]=26*26;
    REP(i,2,n) {
        dp[i+1] = dp[i]*25 % mod;
    }
    dp1[2][2][0][0] = 1;
    dp1[2][1][0][1] = 25;
    dp1[2][1][1][0] = 25;
    dp1[2][0][1][1] = 25*25;
    REP(i,2,n)rep(j,n+1)rep(k1,2)rep(k2,2){
        dp1[i][j][k1][k2] %= mod;
        if(!dp1[i][j][k1][k2])continue;
        int num[] = {1, 25};
        rep(k3,2)dp1[i+1][j+(k3==0)][k2][k3]+=(num[k3]-(k1==k3))*dp1[i][j][k1][k2];

    }
    int num[] = {1, 1, 24};
    rep(k1,3)rep(k2,3){
        dp2[0][(k1==0)+(k2==0)][(k1==1)+(k2==1)][k1][k2] += num[k1]*num[k2]; 
    }

    REP(i,2,n){
        int cur = i % 2, nxt = cur ^ 1;
        rep(j1,n+1)rep(j2,n+1)rep(k1,3)rep(k2,3){
            dp2[nxt][j1][j2][k1][k2]=0;
        }
        rep(j1,n+1)rep(j2,n+1)rep(k1,3)rep(k2,3){
            dp2[cur][j1][j2][k1][k2]%=mod;
            if(!dp2[cur][j1][j2][k1][k2])continue;
            rep(k3,3)dp2[nxt][j1+(k3==0)][j2+(k3==1)][k2][k3]+=(num[k3]-(k1==k3))*dp2[cur][j1][j2][k1][k2];
        }
    }
    vector<int> cnt(26);
    rep(i,26)cin>>cnt[i];
    ll ans = dp[n];
    rep(i,26){
        REP(j,cnt[i]+1, n+1)rep(k,2)rep(l,2)ans+=mod-dp1[n][j][k][l]%mod;
        ans %= mod;
    }
    rep(i1,26)rep(i2,i1){
        REP(j1,cnt[i1]+1,n+1)REP(j2,cnt[i2]+1, n+1)rep(k,3)rep(l,3)(ans+=dp2[n%2][j1][j2][k][l])%=mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}