#include <bits/stdc++.h>
#define MP make_pair
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++ i)
#define foreach(itr, c) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); ++ itr)

typedef long long LL;
typedef pair<int, int> pii;

int ret;
string s;

void dfs(int pos, int cnt, int cur)
{
    if (pos == 10) {
        if (cnt == 4) ret += cur;
        return ;
    }

    if (s[pos] == 'x') {
        dfs(pos + 1, cnt, cur);
        return ;
    }
    int st = s[pos] == 'o' ? 1 : 0;
    for (int i = st; i + cnt <= 4; ++ i) {
        int ncur = cur;
        for (int j = cnt + 1; j <= cnt + i; j ++) ncur *= j;
        for (int j = 1; j <= i; j ++) ncur /= j;
        dfs(pos + 1, cnt + i, ncur);
    }
}

int main()
{
    cin >> s;
    dfs(0, 0, 1);
    printf("%d\n", ret);
    return 0;
}
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

const ll MOD=998244353;

ll dp[102][102][10004];

int main(){FIN;
	ll n; cin>>n;
	vector<ll> a(n);
	fore(i,0,n)cin>>a[i];
	for(ll x=n;x>=0;x--){
		for(ll y=x;y>=0;y--){
			fore(z,0,10004){
				ll &res=dp[x][y][z];
				if(x==n){
					if(z==0)res=1;
					else res=0;
				}else{
					res=dp[x+1][y+1][z+a[x]]*(y+1);
					if(a[x]<=z){
						res=(res+dp[x+1][y][z-a[x]]*(x+1-y))%MOD;
					}else{
						res=(res+dp[x+1][x-y+1][a[x]-z]*(x+1-y))%MOD;
					}
				}
			}
		}
	}
	cout<<dp[0][0][0]<<"\n";
	
	return 0;
}