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;
  K=min(310,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();
  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.at(0).at(0).at(0)=1;
  for(int i=0;i<N;i++){
    for(int j=0;j<=K;j++){
      yr.at(0).at(j).at(i)=dp.at(0).at(j).at(i);
      tr.at(j).at(0).at(i)=dp.at(j).at(0).at(i);
      for(int k=0;k<K;k++){
        yr.at(k+1).at(j).at(i)=(yr.at(k).at(j).at(i)+dp.at(k+1).at(j).at(i))%Q;
        tr.at(j).at(k+1).at(i)=(tr.at(j).at(k).at(i)+dp.at(j).at(k+1).at(i))%Q;
      }
    }
    int b=p.at(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.at(j).at(k-b-1).at(i);
        }
        if(j-P+b-1>=0){
          Y=yr.at(j-P+b-1).at(k).at(i);
        }
        dp.at(j).at(k).at(i+1)=(tr.at(j).at(k).at(i)+yr.at(j).at(k).at(i)-dp.at(j).at(k).at(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.at(i).at(j).at(N);
      Z%=Q;
    }
  }
  cout<<Z<<endl;
}