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 <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  int K;
  int64_t Q=998244353;
  cin>>S>>K;
  vector<int> p;
  int a=0,P=0,V=S.size();
  for(int i=0;i<V;i++){
    if(S.at(i)=='1'){
      a++;
      P++;
    }
    else{
      p.push_back(a);
      a=0;
    }
  }
  int N=p.size();
  K=min(K,P);
  vector<vector<vector<int64_t>>> dp(K+1,vector<vector<int64_t>>(K+1,vector<int64_t>(N+1)));
  vector<vector<vector<int64_t>>> yr(K+1,vector<vector<int64_t>>(K+1,vector<int64_t>(N+1)));
  vector<vector<vector<int64_t>>> tr(K+1,vector<vector<int64_t>>(K+1,vector<int64_t>(N+1)));
  dp[0][0][0]=1;
  for(int i=0;i<N;i++){
    for(int j=0;j<=K;j++){
      yr[j][j][i]=dp[j][j][i];
      tr[K-j][0][i]=dp[K-j][0][i];
      for(int k=j;k<K;k++){
        yr[k+1][j][i]=(yr[k][j][i]+dp[k+1][j][i])%Q;
        tr[K-j][k+1-j][i]=(tr[K-j][k-j][i]+dp[K-j][k+1-j][i])%Q;
      }
    }
    int b=p[i];
    for(int j=0;j<=K;j++){
      for(int k=0;k<=j;k++){
        int64_t X=0,Y=0;
        if(k-b-1>=0){
          X=tr[j][k-b-1][i];
        }
        if(j-P+b-1>=0){
          Y=yr[j-P+b-1][k][i];
        }
        dp[j][k][i+1]=(tr[j][k][i]+yr[j][k][i]-dp[j][k][i]-X-Y+3*Q)%Q;
      }
    }
  }
  int64_t Z=0;
  for(int j=0;j<=K;j++){
    for(int i=j;i<=min(K,j+a);i++){
      Z+=dp[i][j][N];
      Z%=Q;
    }
  }
  cout<<Z<<endl;
}