// Original Python code: // import sys // sys.setrecursionlimit(10**4) // MOD = 998244353 // N,K = list(map(int,input().split())) // // def f(n,now_depth,MAX_DEPTH): // if(n == 2*N):return 1 if now_depth == 0 else 0 // if(memo[n][now_depth] != -1):return memo[n][now_depth] // ret = 0 // # ( // if(now_depth < MAX_DEPTH):ret += f(n+1,now_depth+1,MAX_DEPTH) // # ) // if(now_depth >= 1):ret += f(n+1,now_depth-1,MAX_DEPTH) // // memo[n][now_depth] = ret % MOD // return ret % MOD // // memo = [[-1 for _ in range(K+1)] for _ in range(2*N)] // ans = f(0,0,K) // memo = [[-1 for _ in range(K+1)] for _ in range(2*N)] // ans -= f(0,0,K-1) // print(ans) #include using namespace std; const int MOD = 998244353; int N, K; vector> memo; // f(n, now_depth, MAX_DEPTH) long long f(int n, int now_depth, int MAX_DEPTH) { if (n == 2 * N) { return (now_depth == 0) ? 1 : 0; } if (memo[n][now_depth] != -1) { return memo[n][now_depth]; } long long ret = 0; // "(" if (now_depth < MAX_DEPTH) { ret += f(n + 1, now_depth + 1, MAX_DEPTH); } // ")" if (now_depth >= 1) { ret += f(n + 1, now_depth - 1, MAX_DEPTH); } return memo[n][now_depth] = (ret % MOD); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> K; // First count with MAX_DEPTH = K memo.assign(2 * N, vector(K + 1, -1)); long long ans = f(0, 0, K); // Reset memo and subtract count with MAX_DEPTH = K-1 memo.assign(2 * N, vector(K + 1, -1)); ans = (ans - f(0, 0, K - 1) + MOD) % MOD; cout << ans << "\n"; return 0; }