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>
#define SIZE 305
#define MOD 998244353
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char S[SIZE];
int vx[SIZE];
int dp[2][SIZE][SIZE];
int cur[SIZE][SIZE];
int main()
{
	scanf("%s",&S);
	int K;
	scanf("%d",&K);
	int n=strlen(S);
	int sz=0;
	for(int i=0;i<n;i++)
	{
		if(S[i]=='0')
		{
			vx[sz++]=i;
		}
	}
	if(sz==0)
	{
		puts("1");
		return 0;
	}
	int pos=0;
	for(int h=0;h<n-vx[0];h++)
	{
		dp[pos][h][0]=1;
	}
	for(int i=0;i+1<sz;i++)
	{
		pos=1-pos;
		memset(dp[pos],0,sizeof(dp[pos]));
		int f=vx[i],s=vx[i+1],d=s-f;
		for(int j=n-1;j>=0;j--)
		{
			for(int k=0;k<n;k++)
			{
				cur[j][k]=dp[1-pos][j][k];
				if(j+1<n&&k-1>=0)
				{
					cur[j][k]+=cur[j+1][k-1];
					if(cur[j][k]>=MOD) cur[j][k]-=MOD;
				}
			}
		}
		for(int k=0;k<n;k++)
		{
			int sum=0;
			for(int j=0;s+j<n;j++)
			{
				sum+=dp[1-pos][j][k];
				if(sum>=MOD) sum-=MOD;
				dp[pos][j][k]=sum;
				if(j+1<n&&k>0)
				{
					int p=cur[j+1][k-1];
					if(j+d<n&&k-d>=0)
					{
						p-=cur[j+d][k-d];
						if(p<0) p+=MOD;
					}
					dp[pos][j][k]+=p;
					if(dp[pos][j][k]>=MOD) dp[pos][j][k]-=MOD;
				}
			}
		}
	}
	int ret=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n&&i+j<=K;j++)
		{
			ret+=dp[pos][i][j];
			if(ret>=MOD) ret-=MOD;
		}
	}
	printf("%d\n",ret);
}