//██████╗ ███████╗ ██╗  ██╗
//██╔══██╗██╔════╝██╔██╗██║
//██████╔╝█████╗  ██║██║██║
//██╔══██╗██╔══╝  ██║██║██║
//███████║███████╗██║══██╔╝
//╚══════╝╚══════╝╚═╝  ╚═╝

#include<bits/stdc++.h>
#define ll long long
#define DEBUG
using namespace std;
const int maxn=300010;
const int mod=100007;
const int N = 500 + 7;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1);

int n,m,cnt,ans,flag;

inline int read()
{
    register int c = getchar(), fg = 1, sum = 0;
    while(c > '9' || c < '0' )
    {
        if(c == '-')fg = -1;
        c = getchar();
    }
    while(c <= '9' && c >= '0')
    {
        sum = sum *10 + c - '0';
        c = getchar();
    }
    return fg * sum;
}

void init()
{
    n=read();
    m=read();
}

void go()
{
    ans=0;
    set<int>s;
    for(int i=0;i<n;i++)
    {
        string str;
        cin>>str;
        if(ans<0)continue;
        int a,b;
        for(int j=0;j<m;j++)
        {
            if(str[j]=='S')a=j;
            if(str[j]=='G')b=j;
        }
        if(a<b)ans=-1;
        else s.insert(a-b-1);
    }
    printf("%d\n",ans<0?-1:s.size());
}
int main()
{
    init();
    go();
}


#include<windows.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<queue>
//#include<bits/stdc++.h>

using namespace std;

long long i, j, k, m, M, n, s, co, ans, f, len, T, r, t;
long long ff[1001];
char a[1001][1001];

int main()
{
	scanf("%lld %lld", &n, &m);
	for (i = 1;i <= n;i++)
		scanf("%s", a[i] + 1);

	for (i = 1;i <= n;i++)
		for (j = 1;j <= m;j++)
		{
			if (a[i][j] == 'G')
				f = j;
			else if (a[i][j] == 'S')
			{
				if (f == 0)
				{
					printf("-1");
					return 0;
				}
				else
				{
					ff[j - f] = 1;
					break;
				}
			}
		}
	for (i = 1;i <= m;i++)
		if (ff[i] == 1)
			ans++;

	printf("%lld", ans);

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
char a[1010][1010];
int main()
{
    int n,m;
    set<int>s;
    while(cin>>n>>m)
    {
        s.clear();
        int flag=1;
        int x,y;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>a[i][j];
                if(a[i][j]=='G')x=j;
                else if(a[i][j]=='S')y=j;
            }
            if(y-x<0)flag=0;
            else s.insert(y-x);
        }
        if(flag)cout<<s.size()<<endl;
        else
        {
            cout<<"-1"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,g,s,flag,c[1005],ans;
char ch[1005];
int main(){
	while(scanf("%d%d",&n,&m)!=EOF){
		ans=flag=0;
		memset(c,0,sizeof(c));
		for(int i=1;i<=n;++i){
			scanf("%s",ch+1);
			for(int j=1;j<=m;++j){
				if(ch[j]=='G')g=j;
				if(ch[j]=='S')s=j;
			}
			if(g>s)flag=1;
			else c[s-g]++;
		}
		if(flag)puts("-1");
		else{
			for(int i=1;i<=m;++i)
				if(c[i])ans++;
			printf("%d\n",ans);
		}
	}
	return 0;
}


#include <iostream>
#include <set>
using namespace std;

char game[1005][1005];
set<int> gap;

int main(){
	int n, m, gpos, spos;

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> game[i][j];
			if(game[i][j]=='G')
				gpos=j;
			if(game[i][j]=='S')
				spos=j;
		}
		if(spos < gpos)
			spos=m;
		gap.insert(spos-gpos);
	}

	set<int>::iterator it;
	int soln = -1;
	for(it=gap.begin(); it!=gap.end(); it++){
		if(*it > 0){
			cout<<*it<<"\n";
			break;
		}
		else{
			cout<<soln<<"\n";
		}
	}
}


#include <iostream>
#include <set>
using namespace std;

char game[1005][1005];
set<int> gap;

int main(){
	int n, m, gpos, spos, cnt=0;

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> game[i][j];
			if(game[i][j]=='G')
				gpos=j;
			if(game[i][j]=='S')
				spos=j;
		}
		if(spos < gpos){
			spos=m;
			cnt++;
		}
		if((spos-gpos)!=0)
			gap.insert(spos-gpos);
	}

	int soln = -1;
	if(cnt==0){
		set<int>::iterator it;
		for(it=gap.begin(); it!=gap.end(); it++){
			if(*it > 0){
				cout<<gap.size()<<"\n";
				soln=0;
				break;
			}
		}
	}else{
		cout<<soln<<"\n";
	}
}


#include <iostream>
#include <set>
using namespace std;

char game[1005][1005];
set<int> gap;

int main(){
	int n, m, gpos, spos;

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> game[i][j];
			if(game[i][j]=='G')
				gpos=j;
			if(game[i][j]=='S')
				spos=j;
		}
		gap.insert(spos-gpos);
	}

	set<int>::iterator it;
	int soln = -1;
	for(it=gap.begin(); it!=gap.end(); it++){
		if(*it >= 0){
			cout<<*it<<"\n";
			break;
		}
		else{
			cout<<soln<<"\n";
		}
	}
}


#include <iostream>
#include <set>
using namespace std;

char game[1005][1005];
set<int> gap;

int main(){
	int n, m, gpos, spos;

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> game[i][j];
			if(game[i][j]=='G')
				gpos=j;
			if(game[i][j]=='S')
				spos=j;
		}
		if(spos < gpos)
			spos=m;
		gap.insert(spos-gpos);
	}

	set<int>::iterator it;
	int soln = -1;
	for(it=gap.begin(); it!=gap.end(); it++){
		if(*it >= 0){
			cout<<*it<<"\n";
			break;
		}
		else{
			cout<<soln<<"\n";
		}
	}
}


#include <iostream>
#include <set>
using namespace std;

char game[1005][1005];
set<int> gap;

int main(){
	int n, m, gpos, spos, cnt=0;

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> game[i][j];
			if(game[i][j]=='G')
				gpos=j;
			if(game[i][j]=='S')
				spos=j;
		}
		if(spos < gpos){
			spos=m;
			cnt++;
		}
		if((spos-gpos)!=0)
			gap.insert(spos-gpos);
	}

	int soln = -1;
	if(cnt<n){
		set<int>::iterator it;
		for(it=gap.begin(); it!=gap.end(); it++){
			if(*it > 0){
				cout<<gap.size()<<"\n";
				soln=0;
				break;
			}
		}
	}else{
		cout<<soln<<"\n";
	}
}


#include <bits/stdc++.h>
using namespace std;

char grid[1001][1001];
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > a;
    for(int i = 0;i < n; i++){
        int s, g;
        for(int j = 0; j < m; j++){
            cin >> grid[i][j];
            if(grid[i][j] == 'S')s = j;
            else if(grid[i][j] == 'G')g = j;
        }
        a.push_back({g, s});
    }

    set<int>ss;
    for(int i = 0; i < a.size(); i++){
        if(a[i].first > a[i].second){
            cout << -1 << endl;
            return 0;
        }
        else if(a[i].first < a[i].second)ss.insert(a[i].second-a[i].first);
    }

    cout << ss.size() << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

char grid[1001][1001];
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > a;
    for(int i = 0;i < n; i++){
        int s, g;
        for(int j = 0; j < m; j++){
            cin >> grid[i][j];
            if(grid[i][j] == 'S')s = j;
            else if(grid[i][j] == 'G')g = j;
        }
        a.push_back({s, g});
    }
    int ans = 1e7;
    for(int i = 0; i < a.size(); i++){
        if(a[i].first == 0){
            ans = -1;
            break;
        }
        else if(a[i].first > a[i].second)ans = min(ans, a[i].first - a[i].second);
        else ans = min(ans, a[i].first);
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

char grid[1001][1001];
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > a;
    for(int i = 0;i < n; i++){
        int s, g;
        for(int j = 0; j < m; j++){
            cin >> grid[i][j];
            if(grid[i][j] == 'S')s = j;
            else if(grid[i][j] == 'G')g = j;
        }
        a.push_back({g, s});
    }
    int ans = 1e7;
    for(int i = 0; i < a.size(); i++){
        if(a[i].first == m-1){
            ans = -1;
            break;
        }
        else if(a[i].first < a[i].second)ans = min(ans, a[i].second - a[i].first);
        else ans = min(ans, m - a[i].first - 1);
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

char grid[1001][1001];
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > a;
    for(int i = 0;i < n; i++){
        int s, g;
        for(int j = 0; j < m; j++){
            cin >> grid[i][j];
            if(grid[i][j] == 'S')s = j;
            else if(grid[i][j] == 'G')g = j;
        }
        a.push_back({g, s});
    }
    int ans = 1e7;
    for(int i = 0; i < a.size(); i++){
        if(a[i].first > a[i].second){
            ans = -1;
            break;
        }
        else if(a[i].first < a[i].second)ans = min(ans, a[i].second - a[i].first);
    }
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int>mt;
string a[1007];
int main()
{
	int m,p;
	cin>>m>>p;
	int ans=0;
	for(int i=0;i<m;i++) cin>>a[i];
	int lt=0;
	int aa,bb;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p;j++)
			if(a[i][j]=='G') aa=j;
			else if(a[i][j]=='S') bb=j;
		if(bb-aa<0) lt=1;
		else mt.insert(bb-aa);
	}
	ans=mt.size();
	if(lt) ans=-1;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int>mt;
string a[1007];
int main()
{
	int m,p;
	cin>>m>>p;
	int ans=0;
	for(int i=0;i<m;i++) cin>>a[i];
	int lt=0;
	int aa,bb;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p;j++)
			if(a[i][j]=='G') aa=j;
			else if(a[i][j]=='S') bb=j;
		if(bb-aa<0) lt=1;
		else mt.insert(bb-aa);
	}
	ans=mt.size();
	if(lt) ans=-1;
	cout<<ans<<"\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string a[1007];
int main()
{
	int m,p;
	int ans=0;
	for(int i=0;i<m;i++) cin>>a[i];
	int lt=0;
	int aa,bb;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p;j++)
			if(a[i][j]=='G') aa=j;
			else if(a[i][j]=='S') bb=j;
		if(bb-aa<0) lt=1;
		else ans=max(ans,bb-aa-1);
	}
	if(lt) ans=-1;
	cout<<ans<<"\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
string a[1007];
int main()
{
	int m,p;
	cin>>m>>p;
	int ans=0;
	for(int i=0;i<m;i++) cin>>a[i];
	int lt=0;
	int aa,bb;
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<p;j++)
			if(a[i][j]=='G') aa=j;
			else if(a[i][j]=='S') bb=j;
		if(bb-aa<0) lt=1;
		else ans=max(ans,bb-aa-1);
	}
	if(lt) ans=-1;
	cout<<ans<<"\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()

template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

int main(){
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    for(int i=0; i<n; ++i)
        cin >> s[i];

    int ans = 0;
    for(int i=0; i<n; ++i){
        int c=0, g=0;
        for(int j=0; j<m; ++j){
            if(s[i][j] == 'S')
                c = j;
            if(s[i][j] == 'G')
                g = j;
        }

        if(c-g < 0){
            cout << -1;
            return 0;
        }

        ans = max(ans, c-g);
    }
    cout << ans;
}


#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    4000
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)

#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;

int tmp[4][4];
int dp[N][4][N];

void solve(){
	tmp[0][1] = tmp[0][2] = tmp[0][3] = tmp[3][1] = tmp[3][2] = tmp[3][0] = 1;
	tmp[1][2] = tmp[2][1] = 2;

	int n, k;
	cin>>n>>k;

	dp[1][0][1] = dp[1][3][1] = 1;
	dp[1][1][2] = dp[1][2][2] = 1;
	rep(col,2,n+1) {
		rep(mask, 0, 1<<2) {
			rep(preMask, 0, 1<<2) {
				rep(j,1,k+1) {
					int ind = j + tmp[preMask][mask];
					if(ind > k)
						continue;
					dp[col][mask][ind] = add(dp[col][mask][ind], dp[col-1][preMask][j], 998244353);
				}
			}
		}
	}
	ll ans = 0;
	rep(mask, 0, 1<<2) {
		ans = add(ans, dp[n][mask][k], 998244353);
	}
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    400001
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)

#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;

int tmp[4][4];
int dp[N][4][N];

void solve(){
	tmp[0][1] = tmp[0][2] = tmp[0][3] = tmp[3][1] = tmp[3][2] = tmp[3][0] = 1;
	tmp[1][2] = tmp[2][1] = 2;

	int n, k;
	cin>>n>>k;

	dp[1][0][1] = dp[1][3][1] = 1;
	dp[1][1][2] = dp[1][2][2] = 1;
	rep(col,2,n+1) {
		rep(mask, 0, 1<<2) {
			rep(preMask, 0, 1<<2) {
				rep(j,1,k+1) {
					int ind = j + tmp[preMask][mask];
				//	track4(preMask, mask, ind, dp[col-1][preMask][j]);
					dp[col][mask][ind] = add(dp[col][mask][ind], dp[col-1][preMask][j], 998244353);
				}
			}/*
			track2(col, mask);
			rep(j,1,k+1) {
				track2(j, dp[col][mask][j]);
			}
			cout<<endl;*/
		}
		//cout<<endl;
	}
	ll ans = 0;
	rep(mask, 0, 1<<2) {
		ans = add(ans, dp[n][mask][k], 998244353);
	}
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    10000
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)

#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;

int tmp[4][4];
int dp[N][4][N];

void solve(){
	tmp[0][1] = tmp[0][2] = tmp[0][3] = tmp[3][1] = tmp[3][2] = tmp[3][0] = 1;
	tmp[1][2] = tmp[2][1] = 2;

	int n, k;
	cin>>n>>k;

	dp[1][0][1] = dp[1][3][1] = 1;
	dp[1][1][2] = dp[1][2][2] = 1;
	rep(col,2,n+1) {
		rep(mask, 0, 1<<2) {
			rep(preMask, 0, 1<<2) {
				rep(j,1,k+1) {
					int ind = j + tmp[preMask][mask];
					if(ind > k)
						continue;
					dp[col][mask][ind] = add(dp[col][mask][ind], dp[col-1][preMask][j], 998244353);
				}
			}
		}
	}
	ll ans = 0;
	rep(mask, 0, 1<<2) {
		ans = add(ans, dp[n][mask][k], 998244353);
	}
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    1002
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)

#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;

int tmp[4][4];
int dp[N][4][N];

void solve(){
	tmp[0][1] = tmp[0][2] = tmp[0][3] = tmp[3][1] = tmp[3][2] = tmp[3][0] = 1;
	tmp[1][2] = tmp[2][1] = 2;

	int n, k;
	cin>>n>>k;

	dp[1][0][1] = dp[1][3][1] = 1;
	dp[1][1][2] = dp[1][2][2] = 1;
	rep(col,2,n+1) {
		rep(mask, 0, 1<<2) {
			rep(preMask, 0, 1<<2) {
				rep(j,1,k+1) {
					int ind = j + tmp[preMask][mask];
					if(ind > k)
						continue;
					dp[col][mask][ind] = add(dp[col][mask][ind], dp[col-1][preMask][j], 998244353);
				}
			}
		}
	}
	ll ans = 0;
	rep(mask, 0, 1<<2) {
		ans = add(ans, dp[n][mask][k], 998244353);
	}
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define hell        1000000007
#define N	    1002
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)
#define ll          long long
#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)

#define track(x)                cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int INF = 1e9 + 5;

int tmp[4][4];
int dp[N][4][N];

void solve(){
	tmp[0][1] = tmp[0][2] = tmp[0][3] = tmp[3][1] = tmp[3][2] = tmp[3][0] = 1;
	tmp[1][2] = tmp[2][1] = 2;

	int n, k;
	cin>>n>>k;

	dp[1][0][1] = dp[1][3][1] = 1;
	dp[1][1][2] = dp[1][2][2] = 1;
	rep(col,2,n+1) {
		rep(mask, 0, 1<<2) {
			rep(preMask, 0, 1<<2) {
				rep(j,1,k+1) {
					int ind = j + tmp[preMask][mask];
				//	track4(preMask, mask, ind, dp[col-1][preMask][j]);
					dp[col][mask][ind] = add(dp[col][mask][ind], dp[col-1][preMask][j], 998244353);
				}
			}/*
			track2(col, mask);
			rep(j,1,k+1) {
				track2(j, dp[col][mask][j]);
			}
			cout<<endl;*/
		}
		//cout<<endl;
	}
	ll ans = 0;
	rep(mask, 0, 1<<2) {
		ans = add(ans, dp[n][mask][k], 998244353);
	}
	cout<<ans<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}


/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static Reader scan;
    static PrintWriter pw;
    static int n,k;
    static long MOD = 998244353;
    static long dp[][][];
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new Reader();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        n = ni();k = ni();
        dp = new long[1001][2001][4];
        for(int i=0;i<=1000;++i)
            for(int j=0;j<=2000;++j)
                dp[i][j][0] = dp[i][j][1] = dp[i][j][2] = dp[i][j][3] = -1;
        long res = (f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1));
        res%=MOD;
        pl(res);
        pw.flush();
        pw.close();
    }
    static long f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        int msk = pvd + 2*pvu;
        if(dp[idx][cc][msk]!=-1)
            return dp[idx][cc][msk];
        if(pvu==0 && pvd==0) {
            return dp[idx][cc][msk] =  (f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1))%MOD;
        }
        else if(pvu==0 && pvd==1) {
            return dp[idx][cc][msk] = (f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1))%MOD;
        }
        else if(pvu==1 && pvd==0) {
            return dp[idx][cc][msk] = (f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1))%MOD;
        }
        else { // 1 1
            return dp[idx][cc][msk] = (f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1))%MOD;
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }
}


/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static Reader scan;
    static PrintWriter pw;
    static int n,k;
    static long MOD = 998244353;
    static long dp[][][];
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new Reader();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        n = ni();k = ni();
        dp = new long[1001][2001][4];
        for(int i=0;i<=1000;++i)
            for(int j=0;j<=2000;++j)
                dp[i][j][0] = dp[i][j][1] = dp[i][j][2] = dp[i][j][3] = -1;
        long res = (f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1));
        res%=MOD;
        pl(res);
        pw.flush();
        pw.close();
    }
    static long f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        int msk = pvd + 2*pvu;
        if(dp[idx][cc][msk]!=-1)
            return dp[idx][cc][msk];
        if(pvu==0 && pvd==0) {
            return dp[idx][cc][msk] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        }
        else if(pvu==0 && pvd==1) {
            return dp[idx][cc][msk] = f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
        }
        else if(pvu==1 && pvd==0) {
            return dp[idx][cc][msk] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
        }
        else { // 1 1
            return dp[idx][cc][msk] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }
}


#include <iostream>
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define input cin.tie()
#define ll long long int
using namespace std;
ll MOD = 998244353;
ll dp[1001][2001][2][2];
ll n,k;
/*int dp[1000001],par[1000001],lev[1000001],ans = 0,n,k,u,v;
vector<int> adj[1000001];
void dfs(int x) {
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            lev[u] = lev[x]+1;
            par[u] = x;
            dfs(u);
        }
    }
    vector<int> chu;
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            chu.push_back(dp[u]);
        }
    }
    sort(chu.begin(), chu.end());
        int firstsetkalast = -1;
        //pa("list",list);
        for(int i=0;i<chu.size();++i) {
            int j = i;
            while(j+1<chu.size() && chu[j+1]+chu[j]-2*lev[x]<=k) {
                j++;
            }
            if(i==0)
                firstsetkalast = chu[j];
            else ans++;
            i = j;
        }
        if(chu.size()==0)
            dp[x] = lev[x];
        else dp[x] = firstsetkalast;
}*/

    long f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        if(dp[idx][cc][pvu][pvd]!=-1)
            return dp[idx][cc][pvu][pvd];
        if(pvu==0 && pvd==0) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        dp[idx][cc][pvu][pvd]%=MOD;
         return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==0 && pvd==1) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==1 && pvd==0) {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
    }

int main()
{
    //cout << "Hello world!" << endl;
    fast;
    input;
    cin>>n>>k;
    for(int i=0;i<=1000;++i) {
        for(int j=0;j<=2000;++j) {
            dp[i][j][0][0] = dp[i][j][0][1] = dp[i][j][1][0] = dp[i][j][1][1] = -1;
        }
    }
    cout << f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1);
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define input cin.tie()
#define ll long long int
using namespace std;
ll MOD = 998244353LL;
ll dp[1001][2001][2][2];
ll n,k;
/*int dp[1000001],par[1000001],lev[1000001],ans = 0,n,k,u,v;
vector<int> adj[1000001];
void dfs(int x) {
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            lev[u] = lev[x]+1;
            par[u] = x;
            dfs(u);
        }
    }
    vector<int> chu;
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            chu.push_back(dp[u]);
        }
    }
    sort(chu.begin(), chu.end());
        int firstsetkalast = -1;
        //pa("list",list);
        for(int i=0;i<chu.size();++i) {
            int j = i;
            while(j+1<chu.size() && chu[j+1]+chu[j]-2*lev[x]<=k) {
                j++;
            }
            if(i==0)
                firstsetkalast = chu[j];
            else ans++;
            i = j;
        }
        if(chu.size()==0)
            dp[x] = lev[x];
        else dp[x] = firstsetkalast;
}*/

    ll f(ll idx,ll cc,ll pvu, ll pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        if(dp[idx][cc][pvu][pvd]!=-1)
            return dp[idx][cc][pvu][pvd];
        if(pvu==0 && pvd==0) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        dp[idx][cc][pvu][pvd]%=MOD;
         return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==0 && pvd==1) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==1 && pvd==0) {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else {  // 1 1
            dp[idx][cc][pvu][pvd] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
    }

int main()
{
    //cout << "Hello world!" << endl;
    cin>>n>>k;
    dp[1][1][0][0] = 1;
    dp[1][1][1][1] = 1;
    dp[1][2][0][1] = 1;
    dp[1][2][1][0] = 1;
    for(int len=2;len<=n;++len) {
        for(int cc=1;cc<=k;++cc) {
            dp[len][cc][0][0] = dp[len-1][cc][0][0] + dp[len-1][cc][0][1] + dp[len-1][cc][1][0] + dp[len-1][cc-1][1][1];
            dp[len][cc][0][0]%=MOD;
            dp[len][cc][0][1] = dp[len-1][cc][0][1] + dp[len-1][cc-1][0][0] + dp[len-1][cc-1][1][1] + dp[len-1][cc-2][1][0];
            dp[len][cc][0][1]%=MOD;
            dp[len][cc][1][0] = dp[len-1][cc][1][0] + dp[len-1][cc-1][0][0] + dp[len-1][cc-1][1][1] + dp[len-1][cc-2][0][1];
            dp[len][cc][1][0]%=MOD;
            dp[len][cc][1][1] = dp[len-1][cc-1][0][0] + dp[len-1][cc][0][1] + dp[len-1][cc][1][0] + dp[len-1][cc][1][1];
            dp[len][cc][1][1]%=MOD;
        }
    }
    ll ans = dp[n][k][0][0] + dp[n][k][0][1] + dp[n][k][1][0] + dp[n][k][1][1];
    cout << ans%MOD <<'\n';
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define input cin.tie()
#define ll long long int
using namespace std;
ll MOD = 998244353;
ll dp[1001][2001][2][2];
ll n,k;
/*int dp[1000001],par[1000001],lev[1000001],ans = 0,n,k,u,v;
vector<int> adj[1000001];
void dfs(int x) {
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            lev[u] = lev[x]+1;
            par[u] = x;
            dfs(u);
        }
    }
    vector<int> chu;
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            chu.push_back(dp[u]);
        }
    }
    sort(chu.begin(), chu.end());
        int firstsetkalast = -1;
        //pa("list",list);
        for(int i=0;i<chu.size();++i) {
            int j = i;
            while(j+1<chu.size() && chu[j+1]+chu[j]-2*lev[x]<=k) {
                j++;
            }
            if(i==0)
                firstsetkalast = chu[j];
            else ans++;
            i = j;
        }
        if(chu.size()==0)
            dp[x] = lev[x];
        else dp[x] = firstsetkalast;
}*/

    long f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        if(dp[idx][cc][pvu][pvd]!=-1)
            return dp[idx][cc][pvu][pvd];
        if(pvu==0 && pvd==0) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        dp[idx][cc][pvu][pvd]%=MOD;
         return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==0 && pvd==1) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==1 && pvd==0) {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
    }

int main()
{
    //cout << "Hello world!" << endl;
    fast;
    input;
    cin>>n>>k;
    for(int i=0;i<=1000;++i) {
        for(int j=0;j<=2000;++j) {
            dp[i][j][0][0] = dp[i][j][0][1] = dp[i][j][1][0] = dp[i][j][1][1] = -1;
        }
    }
    cout << (f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1))%MOD;
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define input cin.tie()
#define ll long long int
using namespace std;
ll MOD = 998244353;
ll dp[1001][2001][2][2];
ll n,k;
/*int dp[1000001],par[1000001],lev[1000001],ans = 0,n,k,u,v;
vector<int> adj[1000001];
void dfs(int x) {
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            lev[u] = lev[x]+1;
            par[u] = x;
            dfs(u);
        }
    }
    vector<int> chu;
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            chu.push_back(dp[u]);
        }
    }
    sort(chu.begin(), chu.end());
        int firstsetkalast = -1;
        //pa("list",list);
        for(int i=0;i<chu.size();++i) {
            int j = i;
            while(j+1<chu.size() && chu[j+1]+chu[j]-2*lev[x]<=k) {
                j++;
            }
            if(i==0)
                firstsetkalast = chu[j];
            else ans++;
            i = j;
        }
        if(chu.size()==0)
            dp[x] = lev[x];
        else dp[x] = firstsetkalast;
}*/

    ll f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        if(dp[idx][cc][pvu][pvd]!=-1)
            return dp[idx][cc][pvu][pvd];
        if(pvu==0 && pvd==0) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        dp[idx][cc][pvu][pvd]%=MOD;
         return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==0 && pvd==1) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==1 && pvd==0) {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
    }

int main()
{
    //cout << "Hello world!" << endl;
    fast;
    input;
    cin>>n>>k;
    for(int i=0;i<=1000;++i) {
        for(int j=0;j<=2000;++j) {
            dp[i][j][0][0] = dp[i][j][0][1] = dp[i][j][1][0] = dp[i][j][1][1] = -1;
        }
    }
    cout << (f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1))%MOD;
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false)
#define input cin.tie()
#define ll long long int
using namespace std;
ll MOD = 998244353;
ll dp[1001][2001][2][2];
ll n,k;
/*int dp[1000001],par[1000001],lev[1000001],ans = 0,n,k,u,v;
vector<int> adj[1000001];
void dfs(int x) {
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            lev[u] = lev[x]+1;
            par[u] = x;
            dfs(u);
        }
    }
    vector<int> chu;
    for(int i=0;i<adj[x].size();++i) {
        int u = adj[x][i];
        if(u!=par[x]) {
            chu.push_back(dp[u]);
        }
    }
    sort(chu.begin(), chu.end());
        int firstsetkalast = -1;
        //pa("list",list);
        for(int i=0;i<chu.size();++i) {
            int j = i;
            while(j+1<chu.size() && chu[j+1]+chu[j]-2*lev[x]<=k) {
                j++;
            }
            if(i==0)
                firstsetkalast = chu[j];
            else ans++;
            i = j;
        }
        if(chu.size()==0)
            dp[x] = lev[x];
        else dp[x] = firstsetkalast;
}*/

    long f(int idx,int cc,int pvu, int pvd) {
        if(idx==n) {
            if(cc==k) {
                return 1;
            }
            return 0;
        }
        if(dp[idx][cc][pvu][pvd]!=-1)
            return dp[idx][cc][pvu][pvd];
        if(pvu==0 && pvd==0) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc+1,1,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,1);
        dp[idx][cc][pvu][pvd]%=MOD;
         return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==0 && pvd==1) {
            dp[idx][cc][pvu][pvd] =  f(idx+1,cc,0,0)+f(idx+1,cc,0,1)+f(idx+1,cc+2,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else if(pvu==1 && pvd==0) {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc,0,0)+f(idx+1,cc+2,0,1)+f(idx+1,cc,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
        else {
            dp[idx][cc][pvu][pvd] = f(idx+1,cc+1,0,0)+f(idx+1,cc+1,0,1)+f(idx+1,cc+1,1,0)+f(idx+1,cc,1,1);
            dp[idx][cc][pvu][pvd]%=MOD;
            return dp[idx][cc][pvu][pvd];
        }
    }

int main()
{
    //cout << "Hello world!" << endl;
    fast;
    input;
    cin>>n>>k;
    for(int i=0;i<=1000;++i) {
        for(int j=0;j<=2000;++j) {
            dp[i][j][0][0] = dp[i][j][0][1] = dp[i][j][1][0] = dp[i][j][1][1] = -1;
        }
    }
    cout << (f(1,1,0,0)+f(1,2,0,1)+f(1,2,1,0)+f(1,1,1,1))%MOD << "\n";
    return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;
int dp[N][2 * N][4];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  dp[0][1][0] = dp[0][2][1] = dp[0][2][2] = dp[0][1][3] = 1;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j <= k; j++) {
      for (int l = 0; l < 4; l++)
        dp[i][j][l] %= mod;
      //0 to next
      dp[i + 1][j][0] += dp[i][j][0];
      dp[i + 1][j + 1][1] += dp[i][j][0];
      dp[i + 1][j + 1][2] += dp[i][j][0];
      dp[i + 1][j + 1][3] += dp[i][j][0];
      //1 to next
      dp[i + 1][j][0] += dp[i][j][1];
      dp[i + 1][j][1] += dp[i][j][1];
      dp[i + 1][j + 2][2] += dp[i][j][1];
      dp[i + 1][j][3] += dp[i][j][1];
      //2 to next
      dp[i + 1][j][0] += dp[i][j][2];
      dp[i + 1][j + 2][1] += dp[i][j][2];
      dp[i + 1][j][2] += dp[i][j][2];
      dp[i + 1][j][3] += dp[i][j][2];
      //3 to next
      dp[i + 1][j + 1][0] += dp[i][j][3];
      dp[i + 1][j + 1][1] += dp[i][j][3];
      dp[i + 1][j + 1][2] += dp[i][j][3];
      dp[i + 1][j][3] += dp[i][j][3];
    }
  }
  int ans = 0;
  for (int i = 0; i < 4; i++)
    ans = add(ans, dp[n - 1][k][i]);
  cout << ans << endl;

  return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;

int dp[N][2 * N][2][2];

int fun(int ind, int c, int r1, int r2) {
  if (c > k) return 0;
  if (ind == n) return c == k;
  if (dp[ind][c][r1][r2] != -1) return dp[ind][c][r1][r2];
  ll ans = 0;
  if (r1 == r2) {
    ans += fun(ind + 1, c, r1, r2) % mod;
    ans += fun(ind + 1, c + 1, r1 ^ 1, r2) % mod;
    ans += fun(ind + 1, c + 1, r1, r2 ^ 1) % mod;
    ans += fun(ind + 1, c + 1, r1 ^ 1, r2 ^ 1) % mod;
  } else {
    ans += fun(ind + 1, c, r1, r2) % mod;
    ans += fun(ind + 1, c, r1 ^ 1, r2) % mod;
    ans += fun(ind + 1, c, r1, r2 ^ 1) % mod;
    ans += fun(ind + 1, c + 2, r1 ^ 1, r2 ^ 1) % mod;
  }
  return dp[ind][c][r1][r2] = ans % mod;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  int ans = fun(1, 1, 0, 0);
  ans = add(ans, fun(1, 2, 0, 1));
  ans = add(ans, fun(1, 2, 1, 0));
  ans = add(ans, fun(1, 1, 1, 1));
  cout << ans << endl;

  return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;
ll dp[N][2 * N][4];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  dp[0][1][0] = dp[0][2][1] = dp[0][2][2] = dp[0][1][3] = 1;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j <= k; j++) {
      for (int l = 0; l < 4; l++)
        dp[i][j][l] %= mod;
      //0 to next
      dp[i + 1][j][0] += dp[i][j][0];
      dp[i + 1][j + 1][1] += dp[i][j][0];
      dp[i + 1][j + 1][2] += dp[i][j][0];
      dp[i + 1][j + 1][3] += dp[i][j][0];
      //1 to next
      dp[i + 1][j][0] += dp[i][j][1];
      dp[i + 1][j][1] += dp[i][j][1];
      dp[i + 1][j + 2][2] += dp[i][j][1];
      dp[i + 1][j][3] += dp[i][j][1];
      //2 to next
      dp[i + 1][j][0] += dp[i][j][2];
      dp[i + 1][j + 2][1] += dp[i][j][2];
      dp[i + 1][j][2] += dp[i][j][2];
      dp[i + 1][j][3] += dp[i][j][2];
      //3 to next
      dp[i + 1][j + 1][0] += dp[i][j][3];
      dp[i + 1][j + 1][1] += dp[i][j][3];
      dp[i + 1][j + 1][2] += dp[i][j][3];
      dp[i + 1][j][3] += dp[i][j][3];
    }
  }
  int ans = 0;
  for (int i = 0; i < 4; i++)
    ans = add(ans, dp[n - 1][k][i]);
  cout << ans << endl;

  return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;

int dp[N][2 * N][2][2];

int fun(int ind, int c, int r1, int r2) {
  if (c > k) return 0;
  if (ind == n) return c == k;
  if (dp[ind][c][r1][r2] != -1) return dp[ind][c][r1][r2];
  int ans = 0;
  if (r1 == r2) {
    ans = add(ans, fun(ind + 1, c, r1, r2));
    ans = add(ans, fun(ind + 1, c + 1, r1 ^ 1, r2));
    ans = add(ans, fun(ind + 1, c + 1, r1, r2 ^ 1));
    ans = add(ans, fun(ind + 1, c + 1, r1 ^ 1, r2 ^ 1));
  } else {
    ans = add(ans, fun(ind + 1, c, r1, r2));
    ans = add(ans, fun(ind + 1, c, r1 ^ 1, r2));
    ans = add(ans, fun(ind + 1, c, r1, r2 ^ 1));
    ans = add(ans, fun(ind + 1, c + 2, r1 ^ 1, r2 ^ 1));
  }
  return dp[ind][c][r1][r2] = ans % mod;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  int ans = fun(1, 1, 0, 0);
  ans = add(ans, fun(1, 2, 0, 1));
  ans = add(ans, fun(1, 2, 1, 0));
  ans = add(ans, fun(1, 1, 1, 1));
  cout << ans << endl;

  return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;
ll dp[N][2 * N][4];

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  dp[0][1][0] = dp[0][2][1] = dp[0][2][2] = dp[0][1][3] = 1;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j <= k; j++) {
      for (int l = 0; l < 4; l++)
        dp[i][j][l] %= mod;
      //0 to next
      dp[i + 1][j][0] += dp[i][j][0];
      dp[i + 1][j + 1][1] += dp[i][j][0];
      dp[i + 1][j + 1][2] += dp[i][j][0];
      dp[i + 1][j + 1][3] += dp[i][j][0];
      //1 to next
      dp[i + 1][j][0] += dp[i][j][1];
      dp[i + 1][j][1] += dp[i][j][1];
      dp[i + 1][j + 2][2] += dp[i][j][1];
      dp[i + 1][j][3] += dp[i][j][1];
      //2 to next
      dp[i + 1][j][0] += dp[i][j][2];
      dp[i + 1][j + 2][1] += dp[i][j][2];
      dp[i + 1][j][2] += dp[i][j][2];
      dp[i + 1][j][3] += dp[i][j][2];
      //3 to next
      dp[i + 1][j + 1][0] += dp[i][j][3];
      dp[i + 1][j + 1][1] += dp[i][j][3];
      dp[i + 1][j + 1][2] += dp[i][j][3];
      dp[i + 1][j][3] += dp[i][j][3];
    }
  }
  int ans = 0;
  for (int i = 0; i < 4; i++)
    ans = add(ans, dp[n - 1][k][i] % mod);
  cout << ans << endl;

  return 0;
}


/*input
3 4

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 1e3 + 5;

int n, k;

int dp[N][2 * N][2][2];

int fun(int ind, int c, int r1, int r2) {
  if (c > k) return 0;
  if (ind == n) return c == k;
  if (dp[ind][c][r1][r2] != -1) return dp[ind][c][r1][r2];
  int ans = 0;
  if (r1 == r2) {
    ans += fun(ind + 1, c, r1, r2) % mod;
    ans += fun(ind + 1, c + 1, r1 ^ 1, r2) % mod;
    ans += fun(ind + 1, c + 1, r1, r2 ^ 1) % mod;
    ans += fun(ind + 1, c + 1, r1 ^ 1, r2 ^ 1) % mod;
  } else {
    ans += fun(ind + 1, c, r1, r2) % mod;
    ans += fun(ind + 1, c, r1 ^ 1, r2) % mod;
    ans += fun(ind + 1, c, r1, r2 ^ 1) % mod;
    ans += fun(ind + 1, c + 2, r1 ^ 1, r2 ^ 1) % mod;
  }
  return dp[ind][c][r1][r2] = ans % mod;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  mod = 998244353;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  int ans = fun(1, 1, 0, 0) % mod + fun(1, 2, 0, 1) % mod + fun(1, 2, 1, 0) % mod + fun(1, 1, 1, 1) % mod;
  ans %= mod;
  cout << ans << endl;

  return 0;
}


#include <stdio.h>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iostream>

using namespace std;

long long dp[1500][2500][6];
long long dx[] = {-1,1,0,0};
long long dy[] = {0,0,-1,1};
long long MOD = 998244353;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    long long n, k;
    cin >> n >> k;

    for (long long mask= 0; mask < 4; ++mask)
    {
        long long A = (mask & 1) != 0;
        long long B = (mask & 2) != 0;
        if (A != B)
        {
            dp[1][2][mask]++;
        }
        else
        {
            dp[1][1][mask]++;
        }
    }

    for (long long i = 2; i <= n; ++i)
    {
        for (long long mask = 0; mask < 4; ++mask)
        {
            for (long long j = 1; j <= k; ++j)
            {
                for (long long mask2 = 0; mask2 < 4; ++mask2)
                {
                    long long A = mask & 1 != 0;
                    long long B = mask & 2 != 0;
                    long long A1 = mask2 & 1 != 0;
                    long long B1 = mask2 & 1 != 0;

                    if (mask == mask2)
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j][mask2]) % MOD;
                    else if ((B1 == B && A1 != B1 && A1 != A) || (A1 == A && B1 != B && B1 != A1))
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 1][mask2]) % MOD;
                    else
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 2][mask2])% MOD;
                }
            }
        }
    }

    long long ans = 0;

    for (long long mask = 0; mask < 4; ++mask)
    {
        ans = (ans + dp[n][k][mask]) % MOD;
    }

    cout << ans % MOD << endl;

    return 0;
}


#include <stdio.h>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iostream>

using namespace std;

long long dp[1500][1500][6];
long long dx[] = {-1,1,0,0};
long long dy[] = {0,0,-1,1};
long long MOD = 998244353;

bool IsInsight(long long x, long long y)
{
    return (-1 < x && x < 2 && -1 < y && y < 2);
}

long long comps(string a, string b)
{
    string v[2] = {a,b};
    long long pom[2][2] = {{0,0}, {0,0}};
    long long cnt = 0;
    for (long long i = 0; i < 2; ++i)
    {
        for (long long j = 0; j < 2; ++j)
        {
            if (pom[i][j] == 0)
            {
                cnt++;
            }
            for (long long k = 0; k < 4; ++k)
            {
                if (IsInsight(i + dx[k], j + dy[k]))
                {
                    if (v[i + dx[k]][j + dy[k]] == v[i][j]) pom[i + dx[k]][j + dy[k]] = 1;
                }
            }
        }
    }
    return cnt;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    long long n, k;
    cin >> n >> k;

    for (long long mask= 0; mask < 4; ++mask)
    {
        long long A = (mask & 1) != 0;
        long long B = (mask & 2) != 0;
        if (A != B)
        {
            dp[1][2][mask]++;
        }
        else
        {
            dp[1][1][mask]++;
        }
    }

    for (long long i = 2; i <= n; ++i)
    {
        for (long long mask = 0; mask < 4; ++mask)
        {
            for (long long j = 1; j <= k; ++j)
            {
                for (long long mask2 = 0; mask2 < 4; ++mask2)
                {
                    long long A = mask & 1 != 0;
                    long long B = mask & 2 != 0;
                    long long A1 = mask2 & 1 != 0;
                    long long B1 = mask2 & 1 != 0;

                    if (mask == mask2)
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j][mask2]) % MOD;
                    else if ((B1 == B && A1 != B && A1 != A) || (A1 == A && B1 != B && B != A1))
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 1][mask2]) % MOD;
                    else
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 2][mask2])% MOD;
                }
            }
        }
    }

    long long ans = 0;

    for (long long mask = 0; mask < 4; ++mask)
    {
        ans = (ans + dp[n][k][mask]) % MOD;
    }

    cout << ans << endl;

    return 0;
}


#include <stdio.h>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <iostream>

using namespace std;

long long dp[1500][2500][6];
long long dx[] = {-1,1,0,0};
long long dy[] = {0,0,-1,1};
long long MOD = 998244353;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    long long n, k;
    cin >> n >> k;

    for (long long mask= 0; mask < 4; ++mask)
    {
        long long A = (mask & 1) != 0;
        long long B = (mask & 2) != 0;
        if (A != B)
        {
            dp[1][2][mask]++;
        }
        else
        {
            dp[1][1][mask]++;
        }
    }

    for (long long i = 2; i <= n; ++i)
    {
        for (long long mask = 0; mask < 4; ++mask)
        {
            for (long long j = 1; j <= k; ++j)
            {
                for (long long mask2 = 0; mask2 < 4; ++mask2)
                {
                    long long A = mask & 1 != 0;
                    long long B = mask & 2 != 0;
                    long long A1 = mask2 & 1 != 0;
                    long long B1 = mask2 & 1 != 0;

                    if (mask == mask2)
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j][mask2]) % MOD;
                    else if ((B1 == B && A1 != B && A1 != A) || (A1 == A && B1 != B && B != A1))
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 1][mask2]) % MOD;
                    else
                        dp[i][j][mask] = (dp[i][j][mask] + dp[i - 1][j - 2][mask2])% MOD;
                }
            }
        }
    }

    long long ans = 0;

    for (long long mask = 0; mask < 4; ++mask)
    {
        ans = (ans + dp[n][k][mask]) % MOD;
    }

    cout << ans % MOD << endl;

    return 0;
}


///*
// *
// */
//
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <cstdio>
#include <random>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <functional>
using namespace std;

#define deb(a) if (DEBUG_) {cout << a << endl;}
#define ST double TS = clock()
#define EN double TIME = (clock() - TS) / CLOCKS_PER_SEC
#define cboost ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define repf(i, f, t) for(int i = f; i < t; i++)
#define repfr(i, f, t) for(int i = f; i >= t; i--)
#define infc for(;;)
#define sz(a) (int)a.size()
#define vec vector
#define eq(a, b) (abs(a - b) <= EPS)
#define ll long long
#define cint(n) int n; cin >> n
#define cll(n) int64_t n; cin >> n
#define cing(s) string s; cin >> s
#define cinc(c) char c; cin >> c

const int INF = 2e9;
const int64_t INFL = 9e18;
const bool DEBUG_ = 0;
const double EPS = 1e-6;
const int MOD7 = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int SGM = 26;

inline void add(int &a, int b){
    a = (0LL + a + b) % MOD3;
}

int main(){
    int n, k;
    cin >> n >> k;
    vec<vec<vec<int>>> dp(1 + 4, vec<vec<int>>(1 + n, vec<int>(2 + k, 0)));
    dp[1][1][1] = 1;
    dp[2][1][2] = 1;
    dp[3][1][2] = 1;
    dp[4][1][1] = 1;
    repf(i, 2, 1 + n){
        rep(j, 2 + k){
            {
                add(dp[1][i][j], dp[1][i - 1][j]);
                add(dp[2][i][j + 1], dp[1][i - 1][j]);
                add(dp[3][i][j + 1], dp[1][i - 1][j]);
                add(dp[4][i][j + 1], dp[1][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[2][i - 1][j]);
                add(dp[2][i][j], dp[2][i - 1][j]);
                add(dp[3][i][j + 2], dp[2][i - 1][j]);
                add(dp[4][i][j], dp[2][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[3][i - 1][j]);
                add(dp[2][i][j + 2], dp[3][i - 1][j]);
                add(dp[3][i][j], dp[3][i - 1][j]);
                add(dp[4][i][j], dp[3][i - 1][j]);
            }
            {
                add(dp[1][i][j + 1], dp[4][i - 1][j]);
                add(dp[2][i][j + 1], dp[4][i - 1][j]);
                add(dp[3][i][j + 1], dp[4][i - 1][j]);
                add(dp[4][i][j], dp[4][i - 1][j]);
            }
        }
    }
    repf(i, 1, 1 + n){
        repf(j, 1, 1 + k){
//            cout << dp[1][i][j] + dp[2][i][j] + dp[3][i][j] + dp[4][i][j] << ' ';
        }
//        cout << endl;
    }
    int ans = 0;
    repf(t, 1, 5){
        add(ans, dp[t][n][k]);
    }
    cout << ans;
    return 0;
}


///*
// *
// */
//
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <cstdio>
#include <random>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <functional>
using namespace std;

#define deb(a) if (DEBUG_) {cout << a << endl;}
#define ST double TS = clock()
#define EN double TIME = (clock() - TS) / CLOCKS_PER_SEC
#define cboost ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define repf(i, f, t) for(int i = f; i < t; i++)
#define repfr(i, f, t) for(int i = f; i >= t; i--)
#define infc for(;;)
#define sz(a) (int)a.size()
#define vec vector
#define eq(a, b) (abs(a - b) <= EPS)
#define ll long long
#define cint(n) int n; cin >> n
#define cll(n) int64_t n; cin >> n
#define cing(s) string s; cin >> s
#define cinc(c) char c; cin >> c

const int INF = 2e9;
const int64_t INFL = 9e18;
const bool DEBUG_ = 0;
const double EPS = 1e-6;
const int MOD7 = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int SGM = 26;

inline void add(int &a, int b){
    a = (0LL + a + b) % MOD3;
}

int main(){
    int n, k;
    cin >> n >> k;
    vec<vec<vec<int>>> dp(1 + 4, vec<vec<int>>(1 + n, vec<int>(max(3 + k, 3), 0)));
    dp[1][1][1] = 1;
    dp[2][1][2] = 1;
    dp[3][1][2] = 1;
    dp[4][1][1] = 1;
    repf(i, 2, 1 + n){
        rep(j, 1 + k){
            {
                add(dp[1][i][j], dp[1][i - 1][j]);
                add(dp[2][i][j + 1], dp[1][i - 1][j]);
                add(dp[3][i][j + 1], dp[1][i - 1][j]);
                add(dp[4][i][j + 1], dp[1][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[2][i - 1][j]);
                add(dp[2][i][j], dp[2][i - 1][j]);
                add(dp[3][i][j + 2], dp[2][i - 1][j]);
                add(dp[4][i][j], dp[2][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[3][i - 1][j]);
                add(dp[2][i][j + 2], dp[3][i - 1][j]);
                add(dp[3][i][j], dp[3][i - 1][j]);
                add(dp[4][i][j], dp[3][i - 1][j]);
            }
            {
                add(dp[1][i][j + 1], dp[4][i - 1][j]);
                add(dp[2][i][j + 1], dp[4][i - 1][j]);
                add(dp[3][i][j + 1], dp[4][i - 1][j]);
                add(dp[4][i][j], dp[4][i - 1][j]);
            }
        }
    }
    int ans = 0;
    repf(t, 1, 5){
        add(ans, dp[t][n][k]);
    }
    cout << ans;
    return 0;
}


///*
// *
// */
//
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <cstdio>
#include <random>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <functional>
using namespace std;

#define deb(a) if (DEBUG_) {cout << a << endl;}
#define ST double TS = clock()
#define EN double TIME = (clock() - TS) / CLOCKS_PER_SEC
#define cboost ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define repf(i, f, t) for(int i = f; i < t; i++)
#define repfr(i, f, t) for(int i = f; i >= t; i--)
#define infc for(;;)
#define sz(a) (int)a.size()
#define vec vector
#define eq(a, b) (abs(a - b) <= EPS)
#define ll long long
#define cint(n) int n; cin >> n
#define cll(n) int64_t n; cin >> n
#define cing(s) string s; cin >> s
#define cinc(c) char c; cin >> c

const int INF = 2e9;
const int64_t INFL = 9e18;
const bool DEBUG_ = 0;
const double EPS = 1e-6;
const int MOD7 = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int SGM = 26;

inline void add(int &a, int b){
    a = (0LL + a + b) % MOD3;
}

int main(){
    int n, k;
    cin >> n >> k;
    vec<vec<vec<int>>> dp(1 + 4, vec<vec<int>>(1 + n, vec<int>(2 + k, 0)));
    dp[1][1][1] = 1;
    dp[2][1][2] = 1;
    dp[3][1][2] = 1;
    dp[4][1][1] = 1;
    repf(i, 2, 1 + n){
        rep(j, 1 + k){
            {
                add(dp[1][i][j], dp[1][i - 1][j]);
                add(dp[2][i][j + 1], dp[1][i - 1][j]);
                add(dp[3][i][j + 1], dp[1][i - 1][j]);
                add(dp[4][i][j + 1], dp[1][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[2][i - 1][j]);
                add(dp[2][i][j], dp[2][i - 1][j]);
                add(dp[3][i][j + 2], dp[2][i - 1][j]);
                add(dp[4][i][j], dp[2][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[3][i - 1][j]);
                add(dp[2][i][j + 2], dp[3][i - 1][j]);
                add(dp[3][i][j], dp[3][i - 1][j]);
                add(dp[4][i][j], dp[3][i - 1][j]);
            }
            {
                add(dp[1][i][j + 1], dp[4][i - 1][j]);
                add(dp[2][i][j + 1], dp[4][i - 1][j]);
                add(dp[3][i][j + 1], dp[4][i - 1][j]);
                add(dp[4][i][j], dp[4][i - 1][j]);
            }
        }
    }
    repf(i, 1, 1 + n){
        repf(j, 1, 1 + k){
//            cout << dp[1][i][j] + dp[2][i][j] + dp[3][i][j] + dp[4][i][j] << ' ';
        }
//        cout << endl;
    }
    int ans = 0;
    repf(t, 1, 5){
        add(ans, dp[t][n][k]);
    }
    cout << ans;
    return 0;
}


///*
// *
// */
//
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("-O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cassert>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <cstdio>
#include <random>
#include <stack>
#include <cstdlib>
#include <numeric>
#include <functional>
using namespace std;

#define deb(a) if (DEBUG_) {cout << a << endl;}
#define ST double TS = clock()
#define EN double TIME = (clock() - TS) / CLOCKS_PER_SEC
#define cboost ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(20)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define repf(i, f, t) for(int i = f; i < t; i++)
#define repfr(i, f, t) for(int i = f; i >= t; i--)
#define infc for(;;)
#define sz(a) (int)a.size()
#define vec vector
#define eq(a, b) (abs(a - b) <= EPS)
#define ll long long
#define cint(n) int n; cin >> n
#define cll(n) int64_t n; cin >> n
#define cing(s) string s; cin >> s
#define cinc(c) char c; cin >> c

const int INF = 2e9;
const int64_t INFL = 9e18;
const bool DEBUG_ = 0;
const double EPS = 1e-6;
const int MOD7 = 1e9 + 7;
const int MOD9 = 1e9 + 9;
const int MOD3 = 998244353;
const int SGM = 26;

inline void add(int &a, int b){
    a = (0LL + a + b) % MOD3;
}

int main(){
    int n, k;
    cin >> n >> k;
    vec<vec<vec<int>>> dp(1 + 4, vec<vec<int>>(1 + n, vec<int>(2 + k, 0)));
    dp[1][1][1] = 1;
    dp[2][1][2] = 1;
    dp[3][1][2] = 1;
    dp[4][1][1] = 1;
    repf(i, 2, 1 + n){
        rep(j, 2 + k){
            {
                add(dp[1][i][j], dp[1][i - 1][j]);
                add(dp[2][i][j + 1], dp[1][i - 1][j]);
                add(dp[3][i][j + 1], dp[1][i - 1][j]);
                add(dp[4][i][j + 1], dp[1][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[2][i - 1][j]);
                add(dp[2][i][j], dp[2][i - 1][j]);
                add(dp[3][i][j + 2], dp[2][i - 1][j]);
                add(dp[4][i][j], dp[2][i - 1][j]);
            }
            {
                add(dp[1][i][j], dp[3][i - 1][j]);
                add(dp[2][i][j + 2], dp[3][i - 1][j]);
                add(dp[3][i][j], dp[3][i - 1][j]);
                add(dp[4][i][j], dp[3][i - 1][j]);
            }
            {
                add(dp[1][i][j + 1], dp[4][i - 1][j]);
                add(dp[2][i][j + 1], dp[4][i - 1][j]);
                add(dp[3][i][j + 1], dp[4][i - 1][j]);
                add(dp[4][i][j], dp[4][i - 1][j]);
            }
        }
    }
    repf(i, 1, 1 + n){
        repf(j, 1, 1 + k){
//            cout << dp[1][i][j] + dp[2][i][j] + dp[3][i][j] + dp[4][i][j] << ' ';
        }
//        cout << endl;
    }
    int ans = 0;
    repf(t, 1, 5){
        add(ans, dp[t][n][k]);
    }
    cout << ans;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define MOD 998244353

int agregaComp[4][4] =
{
    {0, 1, 1, 1},
    {0, 0, 2, 0},
    {0, 2, 0, 0},
    {1, 1, 1, 0}
};

///[cantColumnas][cantComp][ultCol]
int dp[1001][5002][4];

int main()
{
    int n, k;
    cin >> n >> k;

    dp[1][1][0] = 1;
    dp[1][2][1] = 1;
    dp[1][2][2] = 1;
    dp[1][1][3] = 1;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            for(int ultCol=0; ultCol<4; ultCol++)
            {
                for(int newCol=0; newCol<4; newCol++)
                {
                    int km = j+agregaComp[ultCol][newCol];
                    if(km <= k)
                    {
                        dp[i+1][km][newCol] = (dp[i+1][km][newCol]+dp[i][j][ultCol])%MOD;
                    }
                }
            }
        }
    }

    int res = 0;
    for(int i=0; i<4; i++)
        res = (res+dp[n][k][i])%MOD;
    cout << res << endl;

/*
    for(int j=1; j<=k; j++)
    {
        for(int i=1; i<=n; i++)
        {
            cout <<  "(" << dp[i][j][0] << ",";
            cout << dp[i][j][1] << ",";
            cout << dp[i][j][2] << ",";
            cout << dp[i][j][3] << ") ";

        }
        cout << endl;
    }
*/

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define MOD 998244353

int agregaComp[4][4] =
{
    {0, 1, 1, 1},
    {0, 0, 2, 0},
    {0, 2, 0, 0},
    {1, 1, 1, 0}
};

///[cantColumnas][cantComp][ultCol]
int dp[1010][2020][4];

int main()
{
    int n, k, km, res = 0;
    cin >> n >> k;

    dp[1][1][0] = 1;
    dp[1][2][1] = 1;
    dp[1][2][2] = 1;
    dp[1][1][3] = 1;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            for(int ultCol=0; ultCol<4; ultCol++)
            {
                for(int newCol=0; newCol<4; newCol++)
                {
                    km = j+agregaComp[ultCol][newCol];
                    if(km <= k)
                    {
                        dp[i+1][km][newCol] = (dp[i+1][km][newCol]+dp[i][j][ultCol])%MOD;
                    }
                }
            }
        }
    }

    for(int i=0; i<4; i++)
        res = (res+dp[n][k][i])%MOD;
    cout << res << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define MOD 998244353

int agregaComp[4][4] =
{
    {0, 1, 1, 1},
    {0, 0, 2, 0},
    {0, 2, 0, 0},
    {1, 1, 1, 0}
};

///[cantColumnas][cantComp][ultCol]
int dp[1010][2020][4];

int main()
{
    int n, k;
    cin >> n >> k;

    dp[1][1][0] = 1;
    dp[1][2][1] = 1;
    dp[1][2][2] = 1;
    dp[1][1][3] = 1;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            for(int ultCol=0; ultCol<4; ultCol++)
            {
                for(int newCol=0; newCol<4; newCol++)
                {
                    int km = j+agregaComp[ultCol][newCol];
                    if(km <= k)
                    {
                        dp[i+1][km][newCol] = (dp[i+1][km][newCol]+dp[i][j][ultCol])%MOD;
                    }
                }
            }
        }
    }

    int res = 0;
    for(int i=0; i<4; i++)
        res = (res+dp[n][k][i])%MOD;
    cout << res << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define MOD 998244353

int agregaComp[4][4] =
{
    {0, 1, 1, 1},
    {0, 0, 2, 0},
    {0, 2, 0, 0},
    {1, 1, 1, 0}
};

///[cantColumnas][cantComp][ultCol]
int dp[2001][3002][4];

int main()
{
    int n, k;
    cin >> n >> k;

    dp[1][1][0] = 1;
    dp[1][2][1] = 1;
    dp[1][2][2] = 1;
    dp[1][1][3] = 1;

    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=k; j++)
        {
            for(int ultCol=0; ultCol<4; ultCol++)
            {
                for(int newCol=0; newCol<4; newCol++)
                {
                    int km = j+agregaComp[ultCol][newCol];
                    if(km <= k)
                    {
                        dp[i+1][km][newCol] = (dp[i+1][km][newCol]+dp[i][j][ultCol])%MOD;
                    }
                }
            }
        }
    }

    int res = 0;
    for(int i=0; i<4; i++)
        res = (res+dp[n][k][i])%MOD;
    cout << res << endl;

/*
    for(int j=1; j<=k; j++)
    {
        for(int i=1; i<=n; i++)
        {
            cout <<  "(" << dp[i][j][0] << ",";
            cout << dp[i][j][1] << ",";
            cout << dp[i][j][2] << ",";
            cout << dp[i][j][3] << ") ";

        }
        cout << endl;
    }
*/

    return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<time.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<vector>
#include<set>
#include<map>
#include<math.h>
#include<utility>
#define ll long long
#define endl "\n"
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

vector<vector<int>>dp[1000];

void solve() {
    int n, k, M = 998244353;
    cin >> n >> k;
    for(int i = 0; i < n; ++i) {
        dp[i] = vector<vector<int>>(4, vector<int>(k + 4, 0));
    }
    for(int i = 0; i < n; ++i)
        for(auto &it : dp[i])
            for(auto &jt : it)
                jt = 0;
    // 0 ww 1 wb 2 bw 3 bb
    int get[4][4] = {{0, 1, 1, 1}, {0, 0, 2, 0}, {0, 2, 0, 0}, {1, 1, 1, 0}};
    for(int i = 0; i < n; ++i) {
        if(!i) {
            dp[0][0][1] = 1;
            dp[0][1][2] = 1;
            dp[0][2][2] = 1;
            dp[0][3][1] = 1;
        }
        else {
            for(int j = 1; j < k + 1; ++j) {
                for(int it = 0; it < 4; ++it)
                    for(int jt = 0; jt < 4; ++jt) {
                        dp[i][jt][j + get[it][jt]] = (dp[i][jt][j + get[it][jt]] + dp[i - 1][it][j]) % M;
                    }
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < 4; ++i)
        ans = (ans + dp[n - 1][i][k]) % M;
    cout << ans;
}
int main() {
    FIO;
    //freopen("input.txt", "r", stdin);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<time.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<vector>
#include<set>
#include<map>
#include<math.h>
#include<utility>
#define ll long long
#define endl "\n"
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;

vector<vector<int>>dp[1000];

void solve() {
    ll n, k, M = 998244353;
    cin >> n >> k;
    for(int i = 0; i < n; ++i) {
        dp[i] = vector<vector<int>>(4, vector<int>(2006, 0));
    }
    for(int i = 0; i < n; ++i)
        for(auto &it : dp[i])
            for(auto &jt : it)
                jt = 0;
    // 0 ww 1 wb 2 bw 3 bb
    int get[4][4] = {{0, 1, 1, 1}, {0, 0, 2, 0}, {0, 2, 0, 0}, {1, 1, 1, 0}};
    for(int i = 0; i < n; ++i) {
        if(!i) {
            dp[0][0][1] = 1;
            dp[0][1][2] = 1;
            dp[0][2][2] = 1;
            dp[0][3][1] = 1;
        }
        else {
            for(int j = 1; j < k + 1; ++j) {
                for(int it = 0; it < 4; ++it)
                    for(int jt = 0; jt < 4; ++jt) {
                        dp[i][jt][j+get[it][jt]]=(dp[i][jt][j+get[it][jt]] + dp[i-1][it][j]) % M;
                    }
            }
        }
    }
    cout << (dp[n - 1][0][k] + dp[n - 1][1][k] + dp[n - 1][2][k] + dp[n - 1][3][k]) % M;
}
int main() {
    FIO;
    //freopen("input.txt", "r", stdin);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}