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

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
(s, k) = input().split()
K = int(k)
if s[-1] == '1':
	s += '0'
n = len(s)
ls = []
cnt = 0
for i in range(n):
	if s[i] == '0':
		ls.append(cnt)
		cnt = 0
	else:
		cnt += 1
l = len(ls)
sm = sum(ls)
mod = 998244353
dp = [[[0 for i in range(sm + 1)] for j in range(sm + 1)] for k in range(l + 1)]
dp[0][0][0] = 1
smprv = 0
for i in range(1, l + 1):
	num = ls[i - 1]
	for j in range(smprv + num, sm + 1):
		if j == smprv + num:
			dp[i][j][0] = 1
		for k in range(1, j + 1):
			x = 0
			for m in range(j + 1):
				if num >= m:
					x += dp[i - 1][j - m][k]
				else:
					x += dp[i - 1][j - m][k - (m - num)]
			dp[i][j][k] = x % mod
	smprv += num
ans = 0
for i in range(sm + 1):
	if i <= K:
		ans += dp[-1][-1][i]
		ans %= mod
print(ans)


(S, K) = input().split()
K = int(K)
MOD = 998244353
L = []
o = '0'
z = '1'
if S[0] == o:
	L.append(0)
	cnt = 0
else:
	cnt = 1
for i in range(1, len(S)):
	if S[i] == o:
		L.append(cnt)
		cnt = 0
	else:
		cnt += 1
if cnt != 0:
	L.append(cnt)
N = len(L)
s = sum(L)
M = min(s, K) + 1
DP = [[[0] * M for _ in range(M)] for _ in range(N)]
s -= L[0]
for i in range(min(s, K) + 1):
	DP[0][0][i] = 1
for i in range(1, N):
	s -= L[i]
	t = min(K, s) + 1
	for j in range(M):
		c = 0
		for k in range(M):
			c = (c + DP[i - 1][j][k]) % MOD
			if k - t >= 0:
				c -= DP[i - 1][j][k - t]
				if c < 0:
					c += MOD
			DP[i][j][k] = c
	t = min(K, L[i])
	for k in range(M):
		c = 0
		for j in range(k + 1):
			DP[i][j][k] = (DP[i][j][k] + c) % MOD
			c = (c + DP[i - 1][j][k]) % MOD
			if j - t >= 0:
				c -= DP[i - 1][j - t][k]
				if c < 0:
					c += MOD
ans = 0
for i in range(M):
	ans = (ans + DP[-1][i][i]) % MOD
print(ans)


(S, Kstring) = input().split()
K = int(Kstring)
lastZero = -1
segment = []
MOD = 998244353
N = len(S)
for i in range(N):
	if S[i] == '0':
		segment.append(i - lastZero - 1)
		lastZero = i
segment.append(N - 1 - lastZero)
M = len(segment)
No1 = N + 1 - M
partialSumSegment = []
for i in range(M):
	if partialSumSegment:
		partialSumSegment.append(segment[i] + partialSumSegment[-1])
	else:
		partialSumSegment.append(segment[i])
DP = []
DPSum = []
for i in range(M):
	DP.append([])
	DPSum.append([])
	for j in range(No1 + 2):
		DP[i].append([])
		DPSum[i].append([])
		for k in range(No1 + 2):
			DP[i][j].append(0)
			DPSum[i][j].append(0)
for j in range(No1 - partialSumSegment[M - 2] + 1):
	DP[M - 1][j][partialSumSegment[M - 2] + j] = 1
for j in range(No1 - partialSumSegment[M - 2] + 1):
	for k in range(partialSumSegment[M - 2] + j, -1, -1):
		DPSum[M - 1][j][k] = DPSum[M - 1][j][k + 1] + DP[M - 1][j][k]
for i in range(M - 2, -1, -1):
	for j in range(No1 + 1):
		Kmin = partialSumSegment[i - 1]
		if i == 0:
			Kmin = 0
		for k in range(No1, Kmin - 1, -1):
			DPCur = 0
			for l in range(1, segment[i] + 1):
				if j >= l and k + segment[i] - l <= No1 + 1:
					DPCur += DP[i + 1][j - l][k + segment[i] - l]
			if k + segment[i] <= No1:
				DPCur += DPSum[i + 1][j][k + segment[i]]
			DP[i][j][k] = DPCur % MOD
			DPSum[i][j][k] = (DPSum[i][j][k + 1] + DP[i][j][k]) % MOD
AnsSum = 0
for j in range(min(K, No1) + 1):
	AnsSum += DP[0][j][0]
if M == 1:
	print(1)
else:
	print(AnsSum % MOD)


MOD = 998244353

def solve(s, k):
	one_count = []
	ones = 0
	for st in s:
		if st == '1':
			ones += 1
		else:
			one_count.append(ones)
			ones = 0
	one_count.append(ones)
	ss = sum(one_count)
	m = len(one_count)
	dp = [[[0] * (ss + 1) for _ in range(ss + 1)] for __ in range(m + 1)]
	dp[0][0][0] = 1
	for i in range(m):
		c = one_count[i]
		for j in range(ss + 1):
			for p in range(ss + 1):
				dp[i][j][p] %= MOD
				for q in range(ss + 1 - max(j, p)):
					dp[i + 1][j + q][p + q] += dp[i][j][p]
				for q in range(-c, 0):
					if j + q >= 0:
						dp[i + 1][j + q][p] += dp[i][j][p]
	res = sum([dp[m][0][p] for p in range(min(k + 1, ss + 1))])
	return res % MOD

def main():
	(s, k_) = input().split()
	k = int(k_)
	res = solve(s, k)
	print(res)

def test():
	assert solve('0101', 1) == 4
	assert solve('01100110', 2) == 14
	assert solve('1101010010101101110111100011011111011000111101110101010010101010101', 20) == 113434815
test()
main()