Problem: Given is a string S consisting of `0` and `1`. Find the number of strings, modulo 998244353, that can result from applying the following operation on S between 0 and K times (inclusive):

* Choose a pair of integers i, j (1\leq i < j\leq |S|) such that the i-th and j-th characters of S are `0` and `1`, respectively. Remove the j-th character from S and insert it to the immediate left of the i-th character.

Constraints

* 1 \leq |S| \leq 300
* 0 \leq K \leq 10^9
* S consists of `0` and `1`.

Input

Input is given from Standard Input in the following format:


S K


Output

Find the number of strings, modulo 998244353, that can result from applying the operation on S between 0 and K times (inclusive).

Examples

Input

0101 1


Output

4


Input

01100110 2


Output

14


Input

1101010010101101110111100011011111011000111101110101010010101010101 20


Output

113434815

Solution (in CPP):

Solution:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
constexpr ll mod = 998244353;
ll dp[301][301][301] = {},dp2[301][301] = {},dp3[301][301] = {};
vector<int> v;
int main(){
    int i,j,k,l,r;
    string s; cin >> s >> k;
    s.push_back('0');
    int n = s.size();
    for(i=0;i<n;i++){
        if(s[i]=='0'){
            int cnt = 0;
            if(i==0) v.push_back(0);
            for(j=i - 1;j>=0;j--){
                if(j!=0 && s[j]=='1'){
                    cnt++;
                }else{
                    v.push_back(cnt);
                    break;
                }
            }
        }
    }
    int m = v.size(),sum = 300;
    dp[m][0][0] = 1;
    for(i=m - 1;i>=0;i--){
        for(l=0;l<=sum;l++){
            dp2[sum][l] = dp[i + 1][sum][l];
            for(j=sum - 1;j>=0;j--){
                dp2[j][l] = dp2[j + 1][l];
                (dp2[j][l] += dp[i + 1][j][l]);
            }
        }
        for(j=0;j<=sum;j++){
            for(l=0;l<=sum;l++){
                (dp[i][j][l] += dp2[j][l]) %= mod;
                for(r=1;r<=min({j,l,v[i]});r++){
                    (dp[i][j][l] += dp[i + 1][j - r][l - r]) %= mod;
                }
            }
        }
    }
    ll ans = 0;
    for(i=0;i<=min(300,k);i++){
        (ans += dp[0][0][i]) %= mod;
    }
    cout << ans << endl;
}