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

const int MOD = 998244353;
struct mi {
    int val;
    explicit operator int() const { return val; }
    mi() { val = 0; }
    mi(const ll& v) {
        val = (-MOD <= v && v <= MOD) ? v : v % MOD;
        if (val < 0) val += MOD; }
    friend ostream& operator<<(ostream& os, const mi& a) { return os << a.val; }
    friend bool operator==(const mi& a, const mi& b) { return a.val == b.val; }
    friend bool operator!=(const mi& a, const mi& b) { return !(a == b); }
    friend bool operator<(const mi& a, const mi& b) { return a.val < b.val; }
    mi operator-() const { return mi(-val); }
    mi& operator+=(const mi& m) {
        if ((val += m.val) >= MOD) val -= MOD;
        return *this; }
    mi& operator-=(const mi& m) {
        if ((val -= m.val) < 0) val += MOD;
        return *this; }
    mi& operator*=(const mi& m) { val = (ll) val * m.val % MOD;
        return *this; }
    friend mi pow(mi a, ll p) {
        mi ans = 1; assert(p >= 0);
        for (; p; p /= 2, a *= a) if (p & 1) ans *= a;
        return ans; }
    friend mi inv(const mi& a) { assert(a != 0); return pow(a, MOD - 2); }
    mi& operator/=(const mi& m) { return (*this) *= inv(m); }
    friend mi operator+(mi a, const mi& b) { return a += b; }
    friend mi operator-(mi a, const mi& b) { return a -= b; }
    friend mi operator*(mi a, const mi& b) { return a *= b; }
    friend mi operator/(mi a, const mi& b) { return a /= b; }
};
const int MAX = 6e3 + 5;
mi fact[MAX], ifact[MAX], len[MAX], dp[MAX][MAX], ones[MAX][MAX], twos[MAX][MAX], twos_total[MAX][MAX], rest[MAX][MAX], rest_total[MAX][MAX], po[MAX], prefix[MAX], up_prefix[MAX];
mi choose(int a, int b){
    if(b < 0 || a < b) return 0;
    return fact[a] * ifact[b] * ifact[a - b];
}
mi sum_prefix(int l, int r){ return prefix[r] - (l == 0 ? 0 : prefix[l - 1]); }

mi sum_up_prefix(int l, int r){ return up_prefix[r] - (l == 0 ? 0 : up_prefix[l - 1]); }
mi progression(int l, int r, int st, int d){ return (sum_up_prefix(l, r) - sum_prefix(l, r) * l) * d + sum_prefix(l, r) * st; }
int n, x;
int main(){
    fact[0] = 1; ifact[0] = 1; po[0] = 1;
    for(int i = 1; i < MAX; i++) fact[i] = fact[i - 1] * i, ifact[i] = ifact[i - 1] / i, po[i] = po[i - 1] * 2;
    ios_base :: sync_with_stdio(0); cin.tie(0);
    cin >> n >> x;
    prefix[0] = 1;
    for(int i = 1; i <= n; i++) prefix[i] = prefix[i - 1] + choose(n, i), up_prefix[i] = up_prefix[i - 1] + choose(n, i) * i;
    mi ans = 0;
    if(x % 2 == 0) for(int i = 0; i < x / 2; i++) ans += choose(n, i);
    else ans += po[n];
    dp[0][0] = 1;
    for(int i = 0; i <= n; i++) for(int j = 0; j < x; j++) dp[i + 1][j + 2] += dp[i][j], dp[i + 1][j + 1] += dp[i][j];
    for(int i = 0; i <= n; i++) for(int j = 0; j < x; j++) ones[i + 2][j + 2] = dp[i][j];
    ones[1][1] += 1;
    for(int i = 0; i <= n; i++) for(int j = 0; j + i <= n; j++) twos[max(i, j)][i + j] += 1;
    for(int j = 0; j <= n; j++) for(int i = 1; i <= max(n, x); i++) twos[i][j] += twos[i - 1][j];
    for(int i = 0; i <= n; i++){
        for(int j = 0; j < n; j++){
            if(j <= i) rest[i][j] = progression(0, j, j + 1, -1);
            else rest[i][j] = progression(j - i, j, i + 1, -1) + progression(max(0, j - 2 * i), j - (i + 1), max(1, 2 * i + 1 - j), 1);
        }
    }
    for(int j = 0; j < n; j++){
        rest_total[0][j]  += choose(n, j);
        for(int i = 1; i <= n; i++){
            if(i > j) rest_total[i][j] = rest_total[i - 1][j];
            else rest_total[i][j] = rest_total[i - 1][j] + choose(n, j - i) * (i + 1);
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < x; j++){
            if(ones[i][j] == 0) continue;
            int mx = min((x - j - 1) / 2, n - 1);
            if(j % 2 == x % 2) ans += ones[i][j] * rest_total[mx][n - i];
            else ans += ones[i][j] * rest[mx][n - i];
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 849588