#include <bitset>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

typedef long long ll;
const int N = 1e5 + 5;
int a[N];

const int mod = 998244353;
/*******快速幂********/
ll qpow(ll x, ll n, ll m)
{ //求解 x的n次方 并求模于m
    x = x % m;
    if (n == 0)
        return 1;
    ll res = 1;
    while (n > 0) {
        if (n & 1) //  判断是否为奇数，若是则true
            res = (res * x) % m;
        x = (x * x) % m;
        n >>= 1; //  相当于n /= 2;
    }
    return res;
}
ll fact[N]; //阶乘
ll infact[N]; //阶乘的逆元
void init()
{
    fact[0] = infact[0] = 1;
    for (int i = 1; i < N; ++i) {
        fact[i] = (ll)fact[i - 1] * i % mod;
        infact[i] = (ll)infact[i - 1] * qpow(i, mod - 2, mod) % mod;
    }
}
ll C(ll a, ll b)
{
    return (ll)fact[a] * infact[b] % mod * infact[a - b] % mod;
}

void solve()
{
    int n;
    cin >> n;
    getchar();
    for (int i = 0; i < n; i++) {
        char ch = getchar();
        if (ch == '1')
            a[i] = 1;
        else
            a[i] = 0;
    }
    ll ze = 0;
    ll on = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == 1) {
            on++;
        } else {
            if (on % 2 == 1)
                on--;
            ze++;
        }
    }

    if (on % 2 == 1)
        on--;
    // cout << on << " " << ze << endl;
    on /= 2;
    // cout << on + ze << " " << on << endl;
    cout << C(on + ze, on) << endl;
}
int main()
{
    init();
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
