You are given a grid, consisting of $2$ rows and $n$ columns. Each cell of this grid should be colored either black or white.

Two cells are considered neighbours if they have a common border and share the same color. Two cells $A$ and $B$ belong to the same component if they are neighbours, or if there is a neighbour of $A$ that belongs to the same component with $B$.

Let's call some bicoloring beautiful if it has exactly $k$ components.

Count the number of beautiful bicolorings. The number can be big enough, so print the answer modulo $998244353$.


-----Input-----

The only line contains two integers $n$ and $k$ ($1 \le n \le 1000$, $1 \le k \le 2n$) — the number of columns in a grid and the number of components required.


-----Output-----

Print a single integer — the number of beautiful bicolorings modulo $998244353$.


-----Examples-----
Input
3 4

Output
12

Input
4 1

Output
2

Input
1 2

Output
2



-----Note-----

One of possible bicolorings in sample $1$: [Image]

Difficulty: MEDIUM_HARD
Tags: Dynamic programming

Bit manipulation
Skill types: Dynamic programming

Bit manipulation

Starter code:

Solutions:
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	(n, k) = RLL()
	dp = [[0] * 4 for _ in range(k + 2)]
	dp[1][0] = 1
	dp[1][3] = 1
	dp[2][1] = 1
	dp[2][2] = 1
	tag = 0
	for i in range(2, n + 1):
		new = [[0] * 4 for _ in range(k + 2)]
		for j in range(1, k + 2):
			for l in range(4):
				tag += 1
				new[j][l] = (dp[j][l] % mod + new[j][l] % mod) % mod
				if l == 0 or l == 3:
					new[j][l] = (dp[j - 1][l ^ 3] % mod + new[j][l] % mod) % mod
					new[j][l] = (dp[j][1] % mod + dp[j][2] % mod + new[j][l] % mod) % mod
				elif l == 1 or l == 2:
					new[j][l] = (dp[j - 1][0] % mod + dp[j - 1][3] % mod + new[j][l] % mod) % mod
					if j - 2 >= 0:
						new[j][l] = (dp[j - 2][l ^ 3] % mod + new[j][l] % mod) % mod
		dp = new
	print(sum(dp[k]) % mod)
main()


ch_0 = {0: [0, 1, 2], 2: [2], 1: [1], 3: [1, 2, 3]}
ch_1 = {0: [3], 3: [0], 1: [0, 3], 2: [0, 3]}
ch_2 = {0: [], 3: [], 2: [1], 1: [2]}
N = 998244353
(n, k) = map(int, input().strip().split(' '))
dp = [[[0] * 4 for j in range(k + 5)] for i in range(n + 5)]
dp[0][1][3] = 1
dp[0][1][0] = 1
dp[0][2][1] = 1
dp[0][2][2] = 1
for i in range(1, n):
	for j in range(1, k + 1):
		for mask in range(4):
			for t in ch_0[mask]:
				dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j][t]) % N
			if j > 1:
				for t in ch_1[mask]:
					dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 1][t]) % N
				if j > 2:
					for t in ch_2[mask]:
						dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 2][t]) % N
ans = 0
for mask in range(4):
	ans = (ans + dp[n - 1][k][mask]) % N
print(ans)


(n, k) = map(int, input().split())
mod = 998244353
dp = [[[0, 0] for j in range(2 * n + 1)] for i in range(n)]
dp[0][0][0] = dp[0][1][1] = 1
for i in range(1, n):
	for j in range(2 * n - 1):
		dp[i][j][0] += (dp[i - 1][j][0] + dp[i - 1][j][1] + dp[i - 1][j][1]) % mod
		dp[i][j + 1][0] += dp[i - 1][j][0] % mod
		dp[i][j + 1][1] += (dp[i - 1][j][0] + dp[i - 1][j][0]) % mod
		dp[i][j][1] += dp[i - 1][j][1] % mod
		dp[i][j + 2][1] += dp[i - 1][j][1] % mod
print(sum(dp[n - 1][k - 1]) * 2 % mod)


import sys
from array import array

def readline() -> str:
	return sys.stdin.buffer.readline().decode('utf-8')
(n, k) = map(int, readline().split())
mod = 998244353
dp = [[array('i', [0]) * (2 * n + 3) for _ in range(n)] for _ in range(4)]
dp[0][0][1] = dp[3][0][1] = 1
dp[1][0][2] = dp[2][0][2] = 1
for i in range(n - 1):
	for j in range(k + 1):
		for sbit in range(4):
			for tbit in range(4):
				add = 1 if sbit == 3 and tbit == 0 or (sbit == 0 and tbit == 3) else (1 if sbit & 2 != tbit & 2 and (tbit == 1 or tbit == 2) else 0) + (1 if sbit & 1 != tbit & 1 and (tbit == 1 or tbit == 2) else 0)
				dp[tbit][i + 1][j + add] += dp[sbit][i][j]
				if dp[tbit][i + 1][j + add] >= mod:
					dp[tbit][i + 1][j + add] -= mod
ans = sum((dp[bit][-1][k] for bit in range(4))) % mod
print(ans)


(n, k) = list(map(int, input().split()))
same = [0] * (k + 1)
diff = [0] * (k + 1)
mod = 998244353
same[1] = 2
if k > 1:
	diff[2] = 2
for i in range(n - 1):
	newsame = [0] * (k + 1)
	newdiff = [0] * (k + 1)
	for i in range(1, k + 1):
		newsame[i] = (same[i] + same[i - 1] + 2 * diff[i]) % mod
	for i in range(2, k + 1):
		newdiff[i] = (2 * same[i - 1] + diff[i] + diff[i - 2]) % mod
	same = newsame
	diff = newdiff
print((same[-1] + diff[-1]) % mod)


import sys
input = sys.stdin.readline
import math
import copy
import collections
from collections import deque
import heapq
import itertools
from collections import defaultdict
from collections import Counter
(n, k) = map(int, input().split())
mod = 998244353
dp = [[[0 for z in range(2)] for j in range(k + 1)] for i in range(n)]
dp[0][1][0] = 1
if k >= 2:
	dp[0][2][1] = 1
for i in range(1, n):
	for j in range(1, k + 1):
		dp[i][j][0] += dp[i - 1][j - 1][0] + dp[i - 1][j][0] + 2 * dp[i - 1][j][1]
		dp[i][j][0] %= mod
		if j - 2 >= 0:
			dp[i][j][1] += 2 * dp[i - 1][j - 1][0] + dp[i - 1][j][1] + dp[i - 1][j - 2][1]
		else:
			dp[i][j][1] += dp[i - 1][j - 1][0] + dp[i - 1][j][1] + dp[i][j - 1][0]
		dp[i][j][1] %= mod
ans = 0
for z in range(2):
	ans += dp[n - 1][k][z]
ans *= 2
print(ans % mod)


(n, K) = map(int, input().split())
dp = [[[0] * 4 for j in range(K + 2)] for i in range(n)]
MOD = 998244353
dp[0][1][0] = 1
dp[0][1][1] = 1
dp[0][2][2] = 1
dp[0][2][3] = 1
for i in range(n - 1):
	for j in range(1, K + 1):
		if j < K + 1:
			for k in range(4):
				dp[i + 1][j][k] += dp[i][j][k]
				dp[i + 1][j][k] %= MOD
			for k in range(2):
				dp[i + 1][j][k] += dp[i][j][2]
				dp[i + 1][j][k] %= MOD
			for k in range(2):
				dp[i + 1][j][k] += dp[i][j][3]
				dp[i + 1][j][k] %= MOD
	for j in range(1, K):
		for k in range(4):
			if k != 0:
				dp[i + 1][j + 1][k] += dp[i][j][0]
				dp[i + 1][j + 1][k] %= MOD
		for k in range(4):
			if k != 1:
				dp[i + 1][j + 1][k] += dp[i][j][1]
				dp[i + 1][j + 1][k] %= MOD
		if j + 2 < K + 1:
			dp[i + 1][j + 2][2] += dp[i][j][3]
			dp[i + 1][j + 2][2] %= MOD
			dp[i + 1][j + 2][3] += dp[i][j][2]
			dp[i + 1][j + 2][3] %= MOD
num = 0
for i in range(4):
	num += dp[n - 1][K][i]
	num %= MOD
print(num)


import sys
import math
from collections import defaultdict, deque
import heapq
(n, k) = map(int, sys.stdin.readline().split())
mod = 998244353
dp = [[0, 0, 0, 0] for x in range(k + 3)]
dp[1][0] = 1
dp[1][1] = 1
dp[2][2] = 1
dp[2][3] = 1
newdp = [[0, 0, 0, 0] for x in range(k + 3)]
for i in range(n - 1):
	for j in range(k + 1):
		newdp[j + 1][1] += dp[j][0]
		newdp[j + 1][3] += dp[j][0]
		newdp[j + 1][2] += dp[j][0]
		newdp[j][0] += dp[j][0]
		newdp[j][1] += dp[j][1]
		newdp[j + 1][3] += dp[j][1]
		newdp[j + 1][2] += dp[j][1]
		newdp[j + 1][0] += dp[j][1]
		newdp[j][1] += dp[j][2]
		newdp[j + 2][3] += dp[j][2]
		newdp[j][2] += dp[j][2]
		newdp[j][0] += dp[j][2]
		newdp[j][1] += dp[j][3]
		newdp[j][3] += dp[j][3]
		newdp[j + 2][2] += dp[j][3]
		newdp[j][0] += dp[j][3]
		for a in range(3):
			for b in range(4):
				newdp[a + j][b] %= mod
	for a in range(k + 3):
		for b in range(4):
			dp[a][b] = newdp[a][b]
			newdp[a][b] = 0
ans = sum(dp[k])
ans %= mod
print(ans)


import itertools
(n, k) = [int(i) for i in input().split()]
kas = [[0, 0, 0, 0], [1, 0, 0, 1], [0, 1, 1, 0]]
mmm = 998244353

def count_k(ka, k, t):
	if t == 0:
		return ka[k][0] + ka[k][1] + ka[k][2] + ka[k - 1][3]
	if t == 1:
		return ka[k - 1][0] + ka[k][1] + ka[k - 2][2] + ka[k - 1][3]
	if t == 2:
		return ka[k - 1][0] + ka[k - 2][1] + ka[k][2] + ka[k - 1][3]
	if t == 3:
		return ka[k - 1][0] + ka[k][1] + ka[k][2] + ka[k][3]
for i in range(1, n):
	if len(kas) < k + 1:
		kas.append([0, 0, 0, 0])
		kas.append([0, 0, 0, 0])
	for kk in range(min(len(kas) - 1, k), 1, -1):
		kas[kk] = [count_k(kas, kk, t) % mmm for t in range(4)]
print(sum(kas[k]) % mmm if k < len(kas) else 0)


(n, k) = map(int, input().split())
mod = 998244353
NEXT = {(0, 1): 2, (1, 2): 2}
for i in range(1, n):
	NOW = NEXT
	NEXT = dict()
	for key in NOW:
		if key[0] == 0:
			if k - (n - i) * 2 <= key[1] <= k:
				NEXT[key] = NEXT.get(key, 0) + NOW[key]
			if k - (n - i) * 2 < key[1] + 1 <= k:
				NEXT[0, key[1] + 1] = NEXT.get((0, key[1] + 1), 0) + NOW[key]
				NEXT[1, key[1] + 1] = NEXT.get((1, key[1] + 1), 0) + NOW[key] * 2 % mod
		else:
			if k - (n - i) * 2 <= key[1] <= k:
				NEXT[key] = NEXT.get(key, 0) + NOW[key]
				NEXT[0, key[1]] = NEXT.get((0, key[1]), 0) + NOW[key] * 2 % mod
			if k - (n - i) * 2 < key[1] + 2 <= k:
				NEXT[1, key[1] + 2] = NEXT.get((1, key[1] + 2), 0) + NOW[key]
ANS = 0
for key in NEXT:
	if key[1] == k:
		ANS = (ANS + NEXT[key]) % mod
print(ANS)


(n, k) = list(map(int, input().split()))
limit = 998244353
if k > 2 * n:
	print(0)
elif k == 1 or k == 2 * n:
	print(2)
else:
	same = [0] * (k + 1)
	same[1] = 2
	diff = [0] * (k + 1)
	diff[2] = 2
	for i in range(2, n + 1):
		for j in range(min(k, 2 * i), 1, -1):
			same[j] = same[j] + 2 * diff[j] + same[j - 1]
			same[j] %= limit
			diff[j] = diff[j] + 2 * same[j - 1] + diff[j - 2]
			diff[j] %= limit
	print((same[k] + diff[k]) % limit)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, sys.stdin.readline().split())
mod = 998244353
dp = [[0, 0, 0, 0] for x in range(k + 3)]
dp[1][0] = 1
dp[1][1] = 1
dp[2][2] = 1
dp[2][3] = 1
newdp = [[0, 0, 0, 0] for x in range(k + 3)]
for i in range(n - 1):
	for j in range(k + 1):
		newdp[j + 1][1] += dp[j][0]
		newdp[j + 1][3] += dp[j][0]
		newdp[j + 1][2] += dp[j][0]
		newdp[j][0] += dp[j][0]
		newdp[j][1] += dp[j][1]
		newdp[j + 1][3] += dp[j][1]
		newdp[j + 1][2] += dp[j][1]
		newdp[j + 1][0] += dp[j][1]
		newdp[j][1] += dp[j][2]
		newdp[j + 2][3] += dp[j][2]
		newdp[j][2] += dp[j][2]
		newdp[j][0] += dp[j][2]
		newdp[j][1] += dp[j][3]
		newdp[j][3] += dp[j][3]
		newdp[j + 2][2] += dp[j][3]
		newdp[j][0] += dp[j][3]
		for a in range(3):
			for b in range(4):
				newdp[a + j][b] %= mod
	for a in range(k + 3):
		for b in range(4):
			dp[a][b] = newdp[a][b]
			newdp[a][b] = 0
ans = sum(dp[k])
ans %= mod
print(ans)


(n, k) = [int(x) for x in input().split()]
dp = [[[0 for _ in range(4)] for _ in range(k + 2)] for _ in range(2)]
dp[1][2][0] = 1
dp[1][2][1] = 1
dp[1][1][2] = 1
dp[1][1][3] = 1
for n1 in range(1, n):
	for k1 in range(1, k + 1):
		dp[0][k1][0] = dp[1][k1][0]
		dp[0][k1][1] = dp[1][k1][1]
		dp[0][k1][2] = dp[1][k1][2]
		dp[0][k1][3] = dp[1][k1][3]
		dp[1][k1][0] = (dp[0][k1][0] + (dp[0][k1 - 2][1] if k1 - 2 >= 0 else 0) + dp[0][k1 - 1][2] + dp[0][k1 - 1][3]) % 998244353
		dp[1][k1][1] = (dp[0][k1][1] + (dp[0][k1 - 2][0] if k1 - 2 >= 0 else 0) + dp[0][k1 - 1][2] + dp[0][k1 - 1][3]) % 998244353
		dp[1][k1][2] = (dp[0][k1][2] + dp[0][k1][1] + dp[0][k1][0] + dp[0][k1 - 1][3]) % 998244353
		dp[1][k1][3] = (dp[0][k1][3] + dp[0][k1][1] + dp[0][k1][0] + dp[0][k1 - 1][2]) % 998244353
total = 0
for i in range(4):
	total += dp[1][k][i] % 998244353
print(total % 998244353)


pri = 998244353
dp = [[[0 for i in range(2001)] for i in range(1001)] for i in range(2)]
(n, k) = map(int, input().split())
for i in range(1, n + 1):
	if i == 1:
		dp[0][i][1] = 2
		dp[1][i][2] = 2
		continue
	for j in range(1, 2 * i + 1):
		dp[0][i][j] = dp[0][i - 1][j] + dp[0][i - 1][j - 1] + 2 * dp[1][i - 1][j]
		dp[0][i][j] %= pri
		dp[1][i][j] = 2 * dp[0][i - 1][j - 1] + dp[1][i - 1][j] + dp[1][i - 1][j - 2]
		dp[0][i][j] %= pri
		dp[1][i][j] %= pri
y = dp[0][n][k] + dp[1][n][k]
y %= pri
print(y)


import os, sys
from io import BytesIO, IOBase

def main():
	mod = 998244353
	(n, k) = map(int, input().split())
	dp = [[[0] * 4 for _ in range(k + 2)] for _ in range(n)]
	dp[0][1] = [0, 1, 1, 0]
	dp[0][0] = [1, 0, 0, 1]
	for i in range(1, n):
		for r in range(k):
			dp[i][r + 1][3] = (dp[i][r + 1][3] + dp[i - 1][r][0]) % mod
			dp[i][r + 1][2] = (dp[i][r + 1][2] + dp[i - 1][r][0]) % mod
			dp[i][r + 1][1] = (dp[i][r + 1][1] + dp[i - 1][r][0]) % mod
			dp[i][r][0] = (dp[i][r][0] + dp[i - 1][r][0]) % mod
			dp[i][r + 2][2] = (dp[i][r + 2][2] + dp[i - 1][r][1]) % mod
			dp[i][r][0] = (dp[i][r][0] + dp[i - 1][r][1]) % mod
			dp[i][r][3] = (dp[i][r][3] + dp[i - 1][r][1]) % mod
			dp[i][r][1] = (dp[i][r][1] + dp[i - 1][r][1]) % mod
			dp[i][r + 2][1] = (dp[i][r + 2][1] + dp[i - 1][r][2]) % mod
			dp[i][r][0] = (dp[i][r][0] + dp[i - 1][r][2]) % mod
			dp[i][r][3] = (dp[i][r][3] + dp[i - 1][r][2]) % mod
			dp[i][r][2] = (dp[i][r][2] + dp[i - 1][r][2]) % mod
			dp[i][r + 1][0] = (dp[i][r + 1][0] + dp[i - 1][r][3]) % mod
			dp[i][r + 1][2] = (dp[i][r + 1][2] + dp[i - 1][r][3]) % mod
			dp[i][r + 1][1] = (dp[i][r + 1][1] + dp[i - 1][r][3]) % mod
			dp[i][r][3] = (dp[i][r][3] + dp[i - 1][r][3]) % mod
	print((dp[-1][k - 1][0] + dp[-1][k - 1][1] + dp[-1][k - 1][2] + dp[-1][k - 1][3]) % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout, exit

def sin():
	return stdin.readline().rstrip()

def listInput():
	return list(map(int, sin().split()))

def printBS(li):
	if not li:
		return
	for i in range(len(li) - 1):
		stdout.write('%d ' % li[i])
	stdout.write('%d\n' % li[-1])
(N, K) = listInput()
MOD = 998244353
dp = [[[0 for _ in range(K + 1)] for _ in range(4)] for _ in range(N + 1)]
dp[1][0][1] = 1
if K > 1:
	dp[1][1][2] = 1
if K > 1:
	dp[1][2][2] = 1
dp[1][3][1] = 1
for n in range(2, N + 1):
	for k in range(1, K + 1):
		dp[n][0][k] = ((dp[n - 1][0][k] + dp[n - 1][1][k]) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k - 1]) % MOD) % MOD
		dp[n][1][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k]) % MOD + ((dp[n - 1][2][k - 2] if k > 1 else 0) + dp[n - 1][3][k - 1]) % MOD) % MOD
		dp[n][2][k] = ((dp[n - 1][0][k - 1] + (dp[n - 1][1][k - 2] if k > 1 else 0)) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k - 1]) % MOD) % MOD
		dp[n][3][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k]) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k]) % MOD) % MOD
print(((dp[N][0][K] + dp[N][1][K]) % MOD + (dp[N][2][K] + dp[N][3][K]) % MOD) % MOD)


mod = 998244353
(N, K) = map(int, input().split())
dp = [[[0] * (K + 2) for i in range(2)] for i in range(N)]
dp[0][0][0] = 1
dp[0][1][1] = 1
for i in range(1, N):
	for b in range(K):
		dp[i][0][b] += dp[i - 1][0][b]
		dp[i][0][b] += dp[i - 1][1][b]
		dp[i][0][b] += dp[i - 1][1][b]
		dp[i][0][b + 1] += dp[i - 1][0][b]
		dp[i][0][b] %= mod
		dp[i][1][b + 1] += dp[i - 1][0][b]
		dp[i][1][b] += dp[i - 1][1][b]
		dp[i][1][b + 2] += dp[i - 1][1][b]
		dp[i][1][b + 1] += dp[i - 1][0][b]
		dp[i][1][b] %= mod
ans = 0
for x in range(2):
	ans += dp[N - 1][x][K - 1]
print(ans * 2 % mod)


(n, k) = map(int, input().split())
mod = 998244353
dp = [[0, 0, 0, 0] for _ in range(k + 1)]
dp[1][0] = dp[1][3] = 1
if k > 1:
	dp[2][2] = dp[2][1] = 1
for x in range(1, n):
	g = [[0, 0, 0, 0] for _ in range(k + 1)]
	g[1][0] = g[1][3] = 1
	for i in range(2, k + 1):
		g[i][0] = (dp[i][0] + dp[i][1] + dp[i][2] + dp[i - 1][3]) % mod
		g[i][1] = (dp[i - 1][0] + dp[i][1] + dp[i - 2][2] + dp[i - 1][3]) % mod
		g[i][2] = (dp[i - 1][0] + dp[i - 2][1] + dp[i][2] + dp[i - 1][3]) % mod
		g[i][3] = (dp[i - 1][0] + dp[i][1] + dp[i][2] + dp[i][3]) % mod
	dp = g
print(sum(dp[-1]) % mod)


(n, K) = map(int, input().split())
mod = 998244353
if K == 1:
	print(2)
	exit()
dp = [[0] * 2 ** 2 for i in range(K + 1)]
dp[1][0] = 1
dp[2][1] = 1
dp[2][2] = 1
dp[1][3] = 1
for i in range(1, n):
	nx = [[0] * 2 ** 2 for i in range(K + 1)]
	for k in range(K + 1):
		for j in range(4):
			if j == 0:
				nx[k][0] += dp[k][j] % mod
				if k + 1 <= K:
					nx[k + 1][1] += dp[k][j] % mod
					nx[k + 1][2] += dp[k][j] % mod
					nx[k + 1][3] += dp[k][j] % mod
			elif j == 1:
				nx[k][0] += dp[k][j] % mod
				nx[k][1] += dp[k][j] % mod
				if k + 2 <= K:
					nx[k + 2][2] += dp[k][j] % mod
				nx[k][3] += dp[k][j] % mod
			elif j == 2:
				nx[k][0] += dp[k][j] % mod
				if k + 2 <= K:
					nx[k + 2][1] += dp[k][j] % mod
				nx[k][2] += dp[k][j] % mod
				nx[k][3] += dp[k][j] % mod
			else:
				if k + 1 <= K:
					nx[k + 1][0] += dp[k][j] % mod
					nx[k + 1][1] += dp[k][j] % mod
					nx[k + 1][2] += dp[k][j] % mod
				nx[k][3] += dp[k][j] % mod
	dp = nx
print(sum(dp[K]) % mod)


def main():
	(n, k) = map(int, input().split(' '))
	if k > 2 * n:
		return 0
	if k == 2 * n or k == 1:
		return 2
	iguales = [0] * (k + 1)
	diferentes = [0] * (k + 1)
	iguales[1] = 2
	diferentes[2] = 2
	modulo = 998244353
	for i in range(1, n):
		(auxigual, auxdiff) = ([0] * (k + 1), [0] * (k + 1))
		for j in range(k):
			auxigual[j + 1] = (iguales[j + 1] + iguales[j] + 2 * diferentes[j + 1]) % modulo
			if j >= 1:
				auxdiff[j + 1] = (diferentes[j + 1] + diferentes[j - 1] + 2 * iguales[j]) % modulo
		iguales = auxigual
		diferentes = auxdiff
	return (iguales[-1] + diferentes[-1]) % modulo
print(main())


import os
import sys
from collections import Counter, deque
from io import BytesIO, IOBase
from math import gcd, inf, sqrt, ceil, radians, cos, sin

def lcm(a, b):
	return a * b // gcd(a, b)

def sieve():
	global spf, adj, MAXN
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(2, MAXN):
		if i * i > MAXN:
			break
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getdistinctFactorization(n):
	global adj, spf, MAXN
	for i in range(1, n + 1):
		index = 1
		x = i
		if x != 1:
			adj[i].append(spf[x])
		x = x // spf[x]
		while x != 1:
			if adj[i][index - 1] != spf[x]:
				adj[i].append(spf[x])
				index += 1
			x = x // spf[x]

def printDivisors(n):
	i = 2
	z = [1, n]
	while i <= sqrt(n):
		if n % i == 0:
			if n / i == i:
				z.append(i)
			else:
				z.append(i)
				z.append(n // i)
		i = i + 1
	return z

def create(n, x, f):
	pq = len(bin(n)[2:])
	if f == 0:
		tt = min
	else:
		tt = max
	dp = [[inf] * n for _ in range(pq)]
	dp[0] = x
	for i in range(1, pq):
		for j in range(n - (1 << i) + 1):
			dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << i - 1)])
	return dp

def enquiry(l, r, dp, f):
	if l > r:
		return inf if not f else -inf
	if f == 1:
		tt = max
	else:
		tt = min
	pq1 = len(bin(r - l + 1)[2:]) - 1
	return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	x = []
	for i in range(2, n + 1):
		if prime[i]:
			x.append(i)
	return x

def func(a, d, i):
	if i == 0:
		return [a[0]]
	an = []
	for j in range(i, 0, -1):
		for xx in func(a, d, j - 1):
			an.append(d[i][j] ^ xx)
	an.append(d[i][0])
	return an

def main():
	(n, k) = map(int, input().split())
	dp = [[[0] * 4 for j in range(k + 4)] for i in range(n)]
	mod = 998244353
	dp[0][1][2] = 1
	dp[0][1][3] = 1
	dp[0][2][1] = 1
	dp[0][2][0] = 1
	for i in range(1, n):
		for j in range(1, k + 1):
			for p in range(4):
				dp[i][j][p] = (dp[i - 1][j][p] + dp[i][j][p]) % mod
			dp[i][j][3] = (dp[i][j][3] + dp[i - 1][j][0]) % mod
			dp[i][j][2] = (dp[i][j][2] + dp[i - 1][j][1]) % mod
			dp[i][j][3] = (dp[i][j][3] + dp[i - 1][j][0]) % mod
			dp[i][j][2] = (dp[i][j][2] + dp[i - 1][j][1]) % mod
			if j > 2:
				dp[i][j][0] = (dp[i - 1][j - 2][1] + dp[i][j][0]) % mod
				dp[i][j][1] = (dp[i][j][1] + dp[i - 1][j - 2][0]) % mod
			if j > 1:
				dp[i][j][0] = (dp[i][j][0] + dp[i - 1][j - 1][2]) % mod
				dp[i][j][0] = (dp[i][j][0] + dp[i - 1][j - 1][3]) % mod
				dp[i][j][1] = (dp[i][j][1] + dp[i - 1][j - 1][2]) % mod
				dp[i][j][1] = (dp[i][j][1] + dp[i - 1][j - 1][3]) % mod
				dp[i][j][3] = (dp[i][j][3] + dp[i - 1][j - 1][2]) % mod
				dp[i][j][2] = (dp[i][j][2] + dp[i - 1][j - 1][3]) % mod
	print(sum(dp[n - 1][k]) % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
MOD = 998244353
(N, K) = ilele()
if K == 1 or K == 2 * N:
	print(2)
	exit(0)
dp = list3d(N + 1, 4, K + 1, 0)
dp[1][0][1] = 1
dp[1][3][1] = 1
dp[1][1][2] = 1
dp[1][2][2] = 1
for n in range(2, N + 1):
	for k in range(1, K + 1):
		dp[n][0][k] = ((dp[n - 1][0][k] + dp[n - 1][1][k]) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k - 1]) % MOD) % MOD
		dp[n][3][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k]) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k]) % MOD) % MOD
		if k > 1:
			dp[n][1][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k]) % MOD + (dp[n - 1][2][k - 2] + dp[n - 1][3][k - 1]) % MOD) % MOD
			dp[n][2][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k - 2]) % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k - 1]) % MOD) % MOD
		else:
			dp[n][1][k] = ((dp[n - 1][0][k - 1] + dp[n - 1][1][k]) % MOD + dp[n - 1][3][k - 1] % MOD) % MOD
			dp[n][2][k] = (dp[n - 1][0][k - 1] % MOD + (dp[n - 1][2][k] + dp[n - 1][3][k - 1]) % MOD) % MOD
print(((dp[N][0][K] + dp[N][1][K]) % MOD + (dp[N][2][K] + dp[N][3][K]) % MOD) % MOD)