#include <bits/stdc++.h>

const int mod = 998244353;

const int max_N = 305;

using LL = long long;

int n, K, a[max_N];

LL dp[max_N][max_N][max_N];
// 前 i 个空隙, 共 j 个 1, 用了 k 步

char s[max_N];

int main() {
    scanf("%s", s);
    n = 1;
    for (int i = 0; i < max_N && s[i]; ++i) {
        if (s[i] == '0') {
            ++n;
        } else {
            ++a[n];
        }
    }
    for (int i = 2; i <= n; ++i) {
        a[i] += a[i - 1];
    }
    scanf("%d", &K);
    K = std::min(K, a[n]);
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = a[i - 1]; j <= a[n]; ++j) {
            for (int k = 0; k <= K; ++k) {
                // 不移动 i, 且从后往 i 移动 m 步
                for (int m = 0; j + a[i] - a[i - 1] + m <= a[n] && k + m <= K; ++m) {
                    int j1 = j + a[i] - a[i - 1] + m;
                    dp[i][j1][k + m] = (dp[i][j1][k + m] + dp[i - 1][j][k]) % mod;
                }
                // 移动 i, 且从 i 往前移动 m 步
                for (int m = a[i] - a[i - 1]; m && j + a[i] - a[i - 1] - m <= a[n]; --m) {
                    int j1 = j + a[i] - a[i - 1] - m;
                    dp[i][j1][k] = (dp[i][j1][k] + dp[i - 1][j][k]) % mod;
                }
            }
        }
    }
    /*
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= a[n]; ++j) {
            for (int k = 0; k <= K; ++k) {
                if (dp[i][j][k]) {
                    printf("dp[%d][%d][%d] = %lld\n", i, j, k, dp[i][j][k]);
                }
            }
        }
    }*/
    LL ans = 0;
    for (int k = 0; k <= K; ++k) {
        ans = (ans + dp[n][a[n]][k]) % mod;
    }
    printf("%lld\n", ans);
}
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

//ａをbで割る
long long mod_div(long long a,long long b){
	if(a % b == 0)return a/b;
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}
 
#define MAX_K 333333
vector<long long> kaijo(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(kaijo[0] != 1){
		kaijo[0] = 1;
		for(long long i = 1;i < MAX_K;i++)kaijo[i] = (kaijo[i-1] * i) % MOD;
	}
    long long ret = kaijo[n];
	long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
    return mod_div(ret,tmp);
}

ll mpow(ll a,ll b){
	ll ret = 1;
	ll tmp = a;
	for(ll i = 0;i <= 60;i++){
		if(b & (1LL << i)){
			ret *= tmp;
			ret %= MOD;
		}
		tmp *= tmp;
		tmp %= MOD;
	}
	return ret;
}

ll comb[1111][1111];
ll dp[1111][1111];

int main(){
	
	ll n,a,b,c,d;cin >> n >> a >> b >> c >> d;
	dp[0][0] = 1;
	
	REP(i,1111){
		REP(j,1111){
			if(j == 0 || i == j)comb[i][j] = 1;
			else comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % MOD;
		}
	}
		
	REP(i,b+1){
		REP(j,n+1)if(dp[i][j]){
			dp[i+1][j] += dp[i][j];
			dp[i+1][j] %= MOD;
			if(i < a)continue;
			ll kake = 1;
			for(ll k = 1;k <= d;k++){
				ll tmp = i * k;
				if(j + tmp > n)break;
				kake = (kake * comb[n-j-tmp+i][i]) % MOD;
				kake = mod_div(kake, k);
				if(k < c)continue;
				dp[i+1][j+tmp] += (dp[i][j] * kake) % MOD;
				dp[i+1][j+tmp] %= MOD;
			}
		}
	}
	
	SHOW2d(comb,10,10);
	SHOW2d(dp,10,10);
	
	cout << dp[b+1][n] << endl;
	
	return 0;
}
