#AGC046C. [AGC046C] Shift

[AGC046C] Shift

Score : 800800 points

Problem Statement

Given is a string SS consisting of 0 and 1. Find the number of strings, modulo 998244353998244353, that can result from applying the following operation on SS between 00 and KK times (inclusive):

  • Choose a pair of integers i,ji, j (1i<jS)(1\leq i < j\leq |S|) such that the ii-th and jj-th characters of SS are 0 and 1, respectively. Remove the jj-th character from SS and insert it to the immediate left of the ii-th character.

Constraints

  • 1S3001 \leq |S| \leq 300
  • 0K1090 \leq K \leq 10^9
  • SS consists of 0 and 1.

Input

Input is given from Standard Input in the following format:

SS KK

Output

Find the number of strings, modulo 998244353998244353, that can result from applying the operation on SS between 00 and KK times (inclusive).

0101 1
4

Four strings, 0101, 0110, 1001, and 1010, can result.

01100110 2
14
1101010010101101110111100011011111011000111101110101010010101010101 20
113434815