#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 998244353;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 4010
ll p2[N];

void xo(string &a, string &b){
	int n = min(a.size(), b.size());
	rep(i, n) a[i] = '0'+(a[i]^b[i]);
}

bool le(string &a, string &b){
	int n = min(a.size(), b.size());
	rep(i, n){
		if(a[i]<b[i]) return true;
		if(a[i]>b[i]) return false;
	}
	return true;
}

void ker(vector<string> &s){
	int n = s.size();
	rep(i, n-1){
		while(s[i].size()>0){
			if(s[i].size()<s[i+1].size()) s[i].swap(s[i+1]);
			xo(s[i], s[i+1]);
			int j = 0;
			while(j<s[i].size() &&s[i][j]=='0') j++;
			s[i].erase(0, j);
		}
	}
}

int main(){
	int n;
	string x;
	cin>>n>>x;
	int m = x.size();
	vector<string> s(n);
	rep(i, n) cin>>s[i];
	ker(s);
	string a(s[n-1]), b(m, '0');
	p2[0] = 1;
	rep(i, N-1) p2[i+1] = p2[i]*2%mod;
	ll res = 0;
	int m2 = a.size(), l = m-m2+1;
	rep(i, l){
		b.erase(0, 1); b += '0';
		if(x[i]=='1'){
			res += p2[l-i-1];
			if(b[0]=='0'){
				xo(b, a);
			}
		} else {
			if(b[0]=='1'){
				xo(b, a);
			}
		}
		res %= mod;
	}
	/*cerr<<"debug"<<endl;
	cerr<<a<<endl;
	cerr<<b<<endl;
	cerr<<x<<endl;*/
	string y = x.substr(m-m2);
	if(le(b, y)) res++;
	cout<<res%mod<<endl;
	return 0;
}
