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 PYTHON3):

Solution:
S,K=input().split()
K=int(K)
K=min(K,300)
mod=998244353
a=[]
val=0
for i in range(len(S)):
    if S[i]=="0":
        a.append(val)
        val=0
    else:
        val+=1

if val!=0:
    a.append(val)
m=len(a)
K=min(sum(a),K)

b=[a[i] for i in range(m)]
c=[a[i] for i in range(m)]
for i in range(1,m):
    b[i]+=b[i-1]
b=[0]+b
for i in range(m-2,-1,-1):
    c[i]+=c[i+1]

dp=[[0 for i in range(K+1)] for j in range(K+1)]
plus=[[0 for j in range(K+1)] for k in range(K+1)]
minus=[[0 for j in range(K+1)] for k in range(K+1)]

for j in range(K+1):
    dp[j][j]=1
    plus[j][j]=1
    minus[j][j]=1

for k in range(K+1):
    for j in range(1,K+1):
        plus[j][k]+=plus[j-1][k]

for j in range(K+1):
    for k in range(1,K+1):
        minus[j][k]+=minus[j][k-1]

for i in range(m-1,-1,-1):
    ndp=[[0 for j in range(K+1)] for k in range(K+1)]
    for k in range(min(b[i],K)+1):
        for j in range(min(K,k+c[i])+1):
            M=max(k-j,-a[i])
            if max(0,M)+j==0:
                ndp[j][k]+=plus[K][k]
            else:
                ndp[j][k]+=plus[K][k]-plus[(max(0,M))+j-1][k]
            if min(K-k,-M)>0:
                ndp[j][k]+=minus[j][k+min(K-k,-M)]-minus[j][k]
            ndp[j][k]%=mod
    dp=ndp
    for j in range(K+1):
        for k in range(K+1):
            plus[j][k]=ndp[j][k]
            minus[j][k]=ndp[j][k]

    for k in range(K+1):
        for j in range(1,K+1):
            plus[j][k]=(plus[j][k]+plus[j-1][k])%mod

    for j in range(K+1):
        for k in range(1,K+1):
            minus[j][k]=(minus[j][k]+minus[j][k-1])%mod


print(dp[0][0])