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;

typedef long long ll;
typedef pair <int , int> pii;

const int N = 3e2+10 , mod = 998244353;

int dp[N][N][N] , ps[N][N][N] , ps2[N][N][N];

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   string s;
   int k;
   cin >> s >> k;
   int n = s.length();
   k = min(k , n);
   int cur = 0;
   vector <int> v;
   for(int i = 0 ; i < n ; i++)
      if(s[i] == '0'){
         v.push_back(cur);
         cur = 0;
      }
      else{
         cur++;
      }
   v.push_back(cur);
   n = v.size();
   dp[n][0][0] = 1;
   ps[n][0][0] = 1;
   for(int i = 0 ; i <= k ; i++)
      ps2[n][i][i] = 1;
   int ans = 0;
   for(int i = n - 1 ; i >= 0 ; i--){
      for(int j = 0 ; j <= k ; j++){
         for(int p = 0 ; p <= k ; p++){
            dp[i][j][p] += ((ps2[i + 1][j][p] - ((j > v[i]) ? ps2[i + 1][j - v[i] - 1][p - v[i] - 1] : 0) + ps[i + 1][j][p] - dp[i + 1][j][p]) % mod + mod) % mod;
            dp[i][j][p] %= mod;
            ps2[i][j][p] = dp[i][j][p];
            if(j && p){
               ps2[i][j][p] += ps2[i][j - 1][p - 1];
               ps2[i][j][p] %= mod;
            }
            //cout << i << " " << j << " " << p << " " << dp[i][j][p] << endl;
         }
         for(int p = k ; p >= 0 ; p--)
            ps[i][j][p] = (dp[i][j][p] + ps[i][j][p + 1]) % mod;
      }
   }
   for(int j = 0 ; j <= k ; j++){
      ans += ps[1][j][0];
      ans %= mod;
   }
   cout << ans;
   return 0;
}