description: XYMXYM and CQXYM will prepare n problems for Codeforces. The difficulty of the problem i will be an integer a_i, where a_i ≥ 0. The difficulty of the problems must satisfy a_i+a_{i+1}<m (1 ≤ i < n), and a_1+a_n<m, where m is a fixed integer. XYMXYM wants to know how many plans of the difficulty of the problems there are modulo 998 244 353.
  
  Two plans of difficulty a and b are different only if there is an integer i (1 ≤ i ≤ n) satisfying a_i ≠ b_i.
  
  Input
  
  A single line contains two integers n and m (2 ≤ n ≤ 50 000, 1 ≤ m ≤ 10^9).
  
  Output
  
  Print a single integer — the number of different plans.
  
  Examples
  
  Input
  
  
  3 2
  
  
  Output
  
  
  4
  
  
  Input
  
  
  5 9
  
  
  Output
  
  
  8105
  
  
  Input
  
  
  21038 3942834
  
  
  Output
  
  
  338529212
  
  Note
  
  In the first test case, the valid a are: [0,0,0], [0,0,1], [0,1,0], [1,0,0].
  
  [1,0,1] is invalid since a_1+a_n ≥ m.
solution: #include <bits/stdc++.h>
  #pragma comment(linker, "/STACK:36777216")
  using namespace std;
  template <class T>
  inline T &RD(T &);
  template <class T>
  inline void OT(const T &);
  inline long long RD() {
    long long x;
    return RD(x);
  }
  inline double &RF(double &);
  inline double RF() {
    double x;
    return RF(x);
  }
  inline char *RS(char *s);
  inline char &RC(char &c);
  inline char RC();
  inline char &RC(char &c) {
    scanf(" %c", &c);
    return c;
  }
  inline char RC() {
    char c;
    return RC(c);
  }
  template <class T>
  inline T &RDD(T &);
  inline long long RDD() {
    long long x;
    return RDD(x);
  }
  template <class T0, class T1>
  inline T0 &RD(T0 &x0, T1 &x1) {
    RD(x0), RD(x1);
    return x0;
  }
  template <class T0, class T1, class T2>
  inline T0 &RD(T0 &x0, T1 &x1, T2 &x2) {
    RD(x0), RD(x1), RD(x2);
    return x0;
  }
  template <class T0, class T1, class T2, class T3>
  inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3) {
    RD(x0), RD(x1), RD(x2), RD(x3);
    return x0;
  }
  template <class T0, class T1, class T2, class T3, class T4>
  inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4) {
    RD(x0), RD(x1), RD(x2), RD(x3), RD(x4);
    return x0;
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5>
  inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {
    RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5);
    return x0;
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
  inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6) {
    RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6);
    return x0;
  }
  template <class T0, class T1>
  inline void OT(const T0 &x0, const T1 &x1) {
    OT(x0), OT(x1);
  }
  template <class T0, class T1, class T2>
  inline void OT(const T0 &x0, const T1 &x1, const T2 &x2) {
    OT(x0), OT(x1), OT(x2);
  }
  template <class T0, class T1, class T2, class T3>
  inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3) {
    OT(x0), OT(x1), OT(x2), OT(x3);
  }
  template <class T0, class T1, class T2, class T3, class T4>
  inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3,
                 const T4 &x4) {
    OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5>
  inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3,
                 const T4 &x4, const T5 &x5) {
    OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
  inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3,
                 const T4 &x4, const T5 &x5, const T6 &x6) {
    OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);
  }
  inline char &RC(char &a, char &b) {
    RC(a), RC(b);
    return a;
  }
  inline char &RC(char &a, char &b, char &c) {
    RC(a), RC(b), RC(c);
    return a;
  }
  inline char &RC(char &a, char &b, char &c, char &d) {
    RC(a), RC(b), RC(c), RC(d);
    return a;
  }
  inline char &RC(char &a, char &b, char &c, char &d, char &e) {
    RC(a), RC(b), RC(c), RC(d), RC(e);
    return a;
  }
  inline char &RC(char &a, char &b, char &c, char &d, char &e, char &f) {
    RC(a), RC(b), RC(c), RC(d), RC(e), RC(f);
    return a;
  }
  inline char &RC(char &a, char &b, char &c, char &d, char &e, char &f, char &g) {
    RC(a), RC(b), RC(c), RC(d), RC(e), RC(f), RC(g);
    return a;
  }
  inline double &RF(double &a, double &b) {
    RF(a), RF(b);
    return a;
  }
  inline double &RF(double &a, double &b, double &c) {
    RF(a), RF(b), RF(c);
    return a;
  }
  inline double &RF(double &a, double &b, double &c, double &d) {
    RF(a), RF(b), RF(c), RF(d);
    return a;
  }
  inline double &RF(double &a, double &b, double &c, double &d, double &e) {
    RF(a), RF(b), RF(c), RF(d), RF(e);
    return a;
  }
  inline double &RF(double &a, double &b, double &c, double &d, double &e,
                    double &f) {
    RF(a), RF(b), RF(c), RF(d), RF(e), RF(f);
    return a;
  }
  inline double &RF(double &a, double &b, double &c, double &d, double &e,
                    double &f, double &g) {
    RF(a), RF(b), RF(c), RF(d), RF(e), RF(f), RF(g);
    return a;
  }
  inline void RS(char *s1, char *s2) { RS(s1), RS(s2); }
  inline void RS(char *s1, char *s2, char *s3) { RS(s1), RS(s2), RS(s3); }
  template <class T0, class T1>
  inline T0 &RDD(T0 &a, T1 &b) {
    RDD(a), RDD(b);
    return a;
  }
  template <class T0, class T1, class T2>
  inline T1 &RDD(T0 &a, T1 &b, T2 &c) {
    RDD(a), RDD(b), RDD(c);
    return a;
  }
  template <class T>
  inline void RST(T &A) {
    memset(A, 0, sizeof(A));
  }
  template <class T>
  inline void FLC(T &A, int x) {
    memset(A, x, sizeof(A));
  }
  template <class T>
  inline void CLR(T &A) {
    A.clear();
  }
  template <class T0, class T1>
  inline void RST(T0 &A0, T1 &A1) {
    RST(A0), RST(A1);
  }
  template <class T0, class T1, class T2>
  inline void RST(T0 &A0, T1 &A1, T2 &A2) {
    RST(A0), RST(A1), RST(A2);
  }
  template <class T0, class T1, class T2, class T3>
  inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3) {
    RST(A0), RST(A1), RST(A2), RST(A3);
  }
  template <class T0, class T1, class T2, class T3, class T4>
  inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4) {
    RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5>
  inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5) {
    RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
  inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6) {
    RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);
  }
  template <class T0, class T1>
  inline void FLC(T0 &A0, T1 &A1, int x) {
    FLC(A0, x), FLC(A1, x);
  }
  template <class T0, class T1, class T2>
  inline void FLC(T0 &A0, T1 &A1, T2 &A2, int x) {
    FLC(A0, x), FLC(A1, x), FLC(A2, x);
  }
  template <class T0, class T1, class T2, class T3>
  inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, int x) {
    FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x);
  }
  template <class T0, class T1, class T2, class T3, class T4>
  inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, int x) {
    FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5>
  inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, int x) {
    FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
  inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6, int x) {
    FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x),
        FLC(A6, x);
  }
  template <class T>
  inline void CLR(priority_queue<T> &Q) {
    while (!Q.empty()) Q.pop();
  }
  template <class T>
  inline void CLR(stack<T> &S) {
    while (!S.empty()) S.pop();
  }
  template <class T>
  inline void CLR(queue<T> &Q) {
    while (!Q.empty()) Q.pop();
  }
  template <class T0, class T1>
  inline void CLR(T0 &A0, T1 &A1) {
    CLR(A0), CLR(A1);
  }
  template <class T0, class T1, class T2>
  inline void CLR(T0 &A0, T1 &A1, T2 &A2) {
    CLR(A0), CLR(A1), CLR(A2);
  }
  template <class T0, class T1, class T2, class T3>
  inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3) {
    CLR(A0), CLR(A1), CLR(A2), CLR(A3);
  }
  template <class T0, class T1, class T2, class T3, class T4>
  inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4) {
    CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5>
  inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5) {
    CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);
  }
  template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
  inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6) {
    CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);
  }
  template <class T>
  inline void CLR(T &A, int n) {
    for (int i = 0; i < n; ++i) CLR(A[i]);
  }
  template <class T>
  inline bool EPT(T &a) {
    return a.empty();
  }
  template <class T>
  inline T &SRT(T &A) {
    sort(A.begin(), A.end());
    return A;
  }
  template <class T, class C>
  inline T &SRT(T &A, C cmp) {
    sort(A.begin(), A.end(), cmp);
    return A;
  }
  template <class T>
  inline T &RVS(T &A) {
    reverse(A.begin(), A.end());
    return A;
  }
  template <class T>
  inline T &UNQQ(T &A) {
    A.resize(unique(A.begin(), A.end()) - A.begin());
    return A;
  }
  template <class T>
  inline T &UNQ(T &A) {
    SRT(A);
    return UNQQ(A);
  }
  template <class T, class C>
  inline T &UNQ(T &A, C cmp) {
    SRT(A, cmp);
    return UNQQ(A);
  }
  const int MOD = int(1e9) + 7;
  const int INF = 0x3f3f3f3f;
  const long long INFF = 0x3f3f3f3f3f3f3f3fLL;
  const double EPS = 1e-9;
  const double OO = 1e20;
  const double PI = acos(-1.0);
  const int dx[] = {-1, 1, 0, 0};
  const int dy[] = {0, 0, 1, -1};
  template <class T>
  inline bool checkMin(T &a, const T b) {
    return b < a ? a = b, 1 : 0;
  }
  template <class T>
  inline bool checkMax(T &a, const T b) {
    return a < b ? a = b, 1 : 0;
  }
  template <class T, class C>
  inline bool checkUpd(T &a, const T b, C c) {
    return c(b, a) ? a = b, 1 : 0;
  }
  template <class T>
  inline T min(T a, T b, T c) {
    return min(min(a, b), c);
  }
  template <class T>
  inline T max(T a, T b, T c) {
    return max(max(a, b), c);
  }
  template <class T>
  inline T min(T a, T b, T c, T d) {
    return min(min(a, b), min(c, d));
  }
  template <class T>
  inline T max(T a, T b, T c, T d) {
    return max(max(a, b), max(c, d));
  }
  template <class T>
  inline T min(T a, T b, T c, T d, T e) {
    return min(min(min(a, b), min(c, d)), e);
  }
  template <class T>
  inline T max(T a, T b, T c, T d, T e) {
    return max(max(max(a, b), max(c, d)), e);
  }
  template <class T>
  inline T sqr(T a) {
    return a * a;
  }
  template <class T>
  inline T cub(T a) {
    return a * a * a;
  }
  template <class T>
  inline T ceil(T x, T y) {
    return (x - 1) / y + 1;
  }
  template <class T>
  T abs(T x) {
    return x > 0 ? x : -x;
  }
  inline int sgn(double x) { return x < -EPS ? -1 : x > EPS; }
  inline int sgn(double x, double y) { return sgn(x - y); }
  inline double cos(double a, double b, double c) {
    return (sqr(a) + sqr(b) - sqr(c)) / (2 * a * b);
  }
  inline double cot(double x) { return 1. / tan(x); };
  inline double sec(double x) { return 1. / cos(x); };
  inline double csc(double x) { return 1. / sin(x); };
  namespace BO {
  inline bool _1(int x, int i) { return bool(x & 1 << i); }
  inline bool _1(long long x, int i) { return bool(x & 1LL << i); }
  inline long long _1(int i) { return 1LL << i; }
  inline long long _U(int i) { return _1(i) - 1; };
  inline int reverse_bits(int x) {
    x = ((x >> 1) & 0x55555555) | ((x << 1) & 0xaaaaaaaa);
    x = ((x >> 2) & 0x33333333) | ((x << 2) & 0xcccccccc);
    x = ((x >> 4) & 0x0f0f0f0f) | ((x << 4) & 0xf0f0f0f0);
    x = ((x >> 8) & 0x00ff00ff) | ((x << 8) & 0xff00ff00);
    x = ((x >> 16) & 0x0000ffff) | ((x << 16) & 0xffff0000);
    return x;
  }
  inline long long reverse_bits(long long x) {
    x = ((x >> 1) & 0x5555555555555555LL) | ((x << 1) & 0xaaaaaaaaaaaaaaaaLL);
    x = ((x >> 2) & 0x3333333333333333LL) | ((x << 2) & 0xccccccccccccccccLL);
    x = ((x >> 4) & 0x0f0f0f0f0f0f0f0fLL) | ((x << 4) & 0xf0f0f0f0f0f0f0f0LL);
    x = ((x >> 8) & 0x00ff00ff00ff00ffLL) | ((x << 8) & 0xff00ff00ff00ff00LL);
    x = ((x >> 16) & 0x0000ffff0000ffffLL) | ((x << 16) & 0xffff0000ffff0000LL);
    x = ((x >> 32) & 0x00000000ffffffffLL) | ((x << 32) & 0xffffffff00000000LL);
    return x;
  }
  template <class T>
  inline bool odd(T x) {
    return x & 1;
  }
  template <class T>
  inline bool even(T x) {
    return !odd(x);
  }
  template <class T>
  inline T low_bit(T x) {
    return x & -x;
  }
  template <class T>
  inline T high_bit(T x) {
    T p = low_bit(x);
    while (p != x) x -= p, p = low_bit(x);
    return p;
  }
  template <class T>
  inline T cover_bit(T x) {
    T p = 1;
    while (p < x) p <<= 1;
    return p;
  }
  template <class T>
  inline int cover_idx(T x) {
    int p = 0;
    while (_1(p) < x) ++p;
    return p;
  }
  inline int clz(int x) { return __builtin_clz(x); }
  inline int clz(long long x) { return __builtin_clzll(x); }
  inline int ctz(int x) { return __builtin_ctz(x); }
  inline int ctz(long long x) { return __builtin_ctzll(x); }
  inline int lg2(int x) { return !x ? -1 : 31 - clz(x); }
  inline int lg2(long long x) { return !x ? -1 : 63 - clz(x); }
  inline int low_idx(int x) { return !x ? -1 : ctz(x); }
  inline int low_idx(long long x) { return !x ? -1 : ctz(x); }
  inline int high_idx(int x) { return lg2(x); }
  inline int high_idx(long long x) { return lg2(x); }
  inline int parity(int x) { return __builtin_parity(x); }
  inline int parity(long long x) { return __builtin_parityll(x); }
  inline int count_bits(int x) { return __builtin_popcount(x); }
  inline int count_bits(long long x) { return __builtin_popcountll(x); }
  }  // namespace BO
  using namespace BO;
  template <class T>
  inline T &RD(T &x) {
    char c;
    while (!isdigit((c = getchar())))
      ;
    x = c - '0';
    while (isdigit((c = getchar()))) x = x * 10 + c - '0';
    return x;
  }
  template <class T>
  inline T &RDD(T &x) {
    char c;
    while ((c = getchar()), c != '-' && !isdigit(c))
      ;
    if (c == '-') {
      x = '0' - (c = getchar());
      while (isdigit((c = getchar()))) x = x * 10 + '0' - c;
    } else {
      x = c - '0';
      while (isdigit((c = getchar()))) x = x * 10 + c - '0';
    }
    return x;
  }
  inline double &RF(double &x) {
    char c;
    while ((c = getchar()), c != '-' && c != '.' && !isdigit(c))
      ;
    if (c == '-')
      if ((c = getchar()) == '.') {
        x = 0;
        double l = 1;
        while (isdigit((c = getchar()))) l /= 10, x = x * 10 + '0' - c;
        x *= l;
      } else {
        x = '0' - c;
        while (isdigit((c = getchar()))) x = x * 10 + '0' - c;
        if (c == '.') {
          double l = 1;
          while (isdigit((c = getchar()))) l /= 10, x = x * 10 + '0' - c;
          x *= l;
        }
      }
    else if (c == '.') {
      x = 0;
      double l = 1;
      while (isdigit((c = getchar()))) l /= 10, x = x * 10 + c - '0';
      x *= l;
    } else {
      x = c - '0';
      while (isdigit((c = getchar()))) x = x * 10 + c - '0';
      if (c == '.') {
        double l = 1;
        while (isdigit((c = getchar()))) l /= 10, x = x * 10 + c - '0';
        x *= l;
      }
    }
    return x;
  }
  inline char *RS(char *s) {
    scanf("%s", s);
    return s;
  }
  long long last_ans;
  int Case;
  template <class T>
  inline void OT(const T &x) {
    cout << x << endl;
  }
  using Int = long long;
  template <class T1, class T2>
  ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
    return os << "(" << a.first << ", " << a.second << ")";
  };
  template <class T>
  void pv(T a, T b) {
    for (T i = a; i != b; ++i) cerr << *i << " ";
    cerr << endl;
  }
  template <class T>
  bool chmin(T &t, const T &f) {
    if (t > f) {
      t = f;
      return true;
    }
    return false;
  }
  template <class T>
  bool chmax(T &t, const T &f) {
    if (t < f) {
      t = f;
      return true;
    }
    return false;
  }
  template <unsigned M_>
  struct ModInt {
    static constexpr unsigned M = M_;
    unsigned x;
    constexpr ModInt() : x(0U) {}
    constexpr ModInt(unsigned x_) : x(x_ % M) {}
    constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
    constexpr ModInt(int x_)
        : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {
    }
    constexpr ModInt(long long x_)
        : x(((x_ %= static_cast<long long>(M)) < 0)
                ? (x_ + static_cast<long long>(M))
                : x_) {}
    ModInt &operator+=(const ModInt &a) {
      x = ((x += a.x) >= M) ? (x - M) : x;
      return *this;
    }
    ModInt &operator-=(const ModInt &a) {
      x = ((x -= a.x) >= M) ? (x + M) : x;
      return *this;
    }
    ModInt &operator*=(const ModInt &a) {
      x = (static_cast<unsigned long long>(x) * a.x) % M;
      return *this;
    }
    ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
    ModInt pow(long long e) const {
      if (e < 0) return inv().pow(-e);
      ModInt a = *this, b = 1U;
      for (; e; e >>= 1) {
        if (e & 1) b *= a;
        a *= a;
      }
      return b;
    }
    ModInt inv() const {
      unsigned a = M, b = x;
      int y = 0, z = 1;
      for (; b;) {
        const unsigned q = a / b;
        const unsigned c = a - q * b;
        a = b;
        b = c;
        const int w = y - static_cast<int>(q) * z;
        y = z;
        z = w;
      }
      assert(a == 1U);
      return ModInt(y);
    }
    ModInt operator+() const { return *this; }
    ModInt operator-() const {
      ModInt a;
      a.x = x ? (M - x) : 0U;
      return a;
    }
    ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
    ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
    ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
    ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
    template <class T>
    friend ModInt operator+(T a, const ModInt &b) {
      return (ModInt(a) += b);
    }
    template <class T>
    friend ModInt operator-(T a, const ModInt &b) {
      return (ModInt(a) -= b);
    }
    template <class T>
    friend ModInt operator*(T a, const ModInt &b) {
      return (ModInt(a) *= b);
    }
    template <class T>
    friend ModInt operator/(T a, const ModInt &b) {
      return (ModInt(a) /= b);
    }
    explicit operator bool() const { return x; }
    bool operator==(const ModInt &a) const { return (x == a.x); }
    bool operator!=(const ModInt &a) const { return (x != a.x); }
    friend std::ostream &operator<<(std::ostream &os, const ModInt &a) {
      return os << a.x;
    }
  };
  constexpr unsigned MO = 998244353U;
  constexpr unsigned MO2 = 2U * MO;
  constexpr int FFT_MAX = 23;
  using Mint = ModInt<MO>;
  constexpr Mint FFT_ROOTS[FFT_MAX + 1] = {
      1U,         998244352U, 911660635U, 372528824U, 929031873U, 452798380U,
      922799308U, 781712469U, 476477967U, 166035806U, 258648936U, 584193783U,
      63912897U,  350007156U, 666702199U, 968855178U, 629671588U, 24514907U,
      996173970U, 363395222U, 565042129U, 733596141U, 267099868U, 15311432U};
  constexpr Mint INV_FFT_ROOTS[FFT_MAX + 1] = {
      1U,         998244352U, 86583718U,  509520358U, 337190230U, 87557064U,
      609441965U, 135236158U, 304459705U, 685443576U, 381598368U, 335559352U,
      129292727U, 358024708U, 814576206U, 708402881U, 283043518U, 3707709U,
      121392023U, 704923114U, 950391366U, 428961804U, 382752275U, 469870224U};
  constexpr Mint FFT_RATIOS[FFT_MAX] = {
      911660635U, 509520358U, 369330050U, 332049552U, 983190778U, 123842337U,
      238493703U, 975955924U, 603855026U, 856644456U, 131300601U, 842657263U,
      730768835U, 942482514U, 806263778U, 151565301U, 510815449U, 503497456U,
      743006876U, 741047443U, 56250497U,  867605899U};
  constexpr Mint INV_FFT_RATIOS[FFT_MAX] = {
      86583718U,  372528824U, 373294451U, 645684063U, 112220581U, 692852209U,
      155456985U, 797128860U, 90816748U,  860285882U, 927414960U, 354738543U,
      109331171U, 293255632U, 535113200U, 308540755U, 121186627U, 608385704U,
      438932459U, 359477183U, 824071951U, 103369235U};
  void fft(Mint *as, int n) {
    assert(!(n & (n - 1)));
    assert(1 <= n);
    assert(n <= 1 << FFT_MAX);
    int m = n;
    if (m >>= 1) {
      for (int i = 0; i < m; ++i) {
        const unsigned x = as[i + m].x;
        as[i + m].x = as[i].x + MO - x;
        as[i].x += x;
      }
    }
    if (m >>= 1) {
      Mint prod = 1U;
      for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
        for (int i = i0; i < i0 + m; ++i) {
          const unsigned x = (prod * as[i + m]).x;
          as[i + m].x = as[i].x + MO - x;
          as[i].x += x;
        }
        prod *= FFT_RATIOS[__builtin_ctz(++h)];
      }
    }
    for (; m;) {
      if (m >>= 1) {
        Mint prod = 1U;
        for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
          for (int i = i0; i < i0 + m; ++i) {
            const unsigned x = (prod * as[i + m]).x;
            as[i + m].x = as[i].x + MO - x;
            as[i].x += x;
          }
          prod *= FFT_RATIOS[__builtin_ctz(++h)];
        }
      }
      if (m >>= 1) {
        Mint prod = 1U;
        for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
          for (int i = i0; i < i0 + m; ++i) {
            const unsigned x = (prod * as[i + m]).x;
            as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;
            as[i + m].x = as[i].x + MO - x;
            as[i].x += x;
          }
          prod *= FFT_RATIOS[__builtin_ctz(++h)];
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;
      as[i].x = (as[i].x >= MO) ? (as[i].x - MO) : as[i].x;
    }
  }
  void invFft(Mint *as, int n) {
    assert(!(n & (n - 1)));
    assert(1 <= n);
    assert(n <= 1 << FFT_MAX);
    int m = 1;
    if (m < n >> 1) {
      Mint prod = 1U;
      for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
        for (int i = i0; i < i0 + m; ++i) {
          const unsigned long long y = as[i].x + MO - as[i + m].x;
          as[i].x += as[i + m].x;
          as[i + m].x = (prod.x * y) % MO;
        }
        prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
      }
      m <<= 1;
    }
    for (; m < n >> 1; m <<= 1) {
      Mint prod = 1U;
      for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
        for (int i = i0; i < i0 + (m >> 1); ++i) {
          const unsigned long long y = as[i].x + MO2 - as[i + m].x;
          as[i].x += as[i + m].x;
          as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;
          as[i + m].x = (prod.x * y) % MO;
        }
        for (int i = i0 + (m >> 1); i < i0 + m; ++i) {
          const unsigned long long y = as[i].x + MO - as[i + m].x;
          as[i].x += as[i + m].x;
          as[i + m].x = (prod.x * y) % MO;
        }
        prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
      }
    }
    if (m < n) {
      for (int i = 0; i < m; ++i) {
        const unsigned y = as[i].x + MO2 - as[i + m].x;
        as[i].x += as[i + m].x;
        as[i + m].x = y;
      }
    }
    const Mint invN = Mint(n).inv();
    for (int i = 0; i < n; ++i) {
      as[i] *= invN;
    }
  }
  void fft(vector<Mint> &as) { fft(as.data(), as.size()); }
  void invFft(vector<Mint> &as) { invFft(as.data(), as.size()); }
  vector<Mint> convolve(vector<Mint> as, vector<Mint> bs) {
    if (as.empty() || bs.empty()) return {};
    const int len = as.size() + bs.size() - 1;
    int n = 1;
    for (; n < len; n <<= 1) {
    }
    as.resize(n);
    fft(as);
    bs.resize(n);
    fft(bs);
    for (int i = 0; i < n; ++i) as[i] *= bs[i];
    invFft(as);
    as.resize(len);
    return as;
  }
  vector<Mint> square(vector<Mint> as) {
    if (as.empty()) return {};
    const int len = as.size() + as.size() - 1;
    int n = 1;
    for (; n < len; n <<= 1) {
    }
    as.resize(n);
    fft(as);
    for (int i = 0; i < n; ++i) as[i] *= as[i];
    invFft(as);
    as.resize(len);
    return as;
  }
  constexpr int LIM_INV = 1 << 20;
  Mint inv[LIM_INV], fac[LIM_INV], invFac[LIM_INV];
  struct ModIntPreparator {
    ModIntPreparator() {
      inv[1] = 1;
      for (int i = 2; i < LIM_INV; ++i)
        inv[i] = -((Mint::M / i) * inv[Mint::M % i]);
      fac[0] = 1;
      for (int i = 1; i < LIM_INV; ++i) fac[i] = fac[i - 1] * i;
      invFac[0] = 1;
      for (int i = 1; i < LIM_INV; ++i) invFac[i] = invFac[i - 1] * inv[i];
    }
  } preparator;
  static constexpr int LIM_POLY = 1 << 20;
  static_assert(LIM_POLY <= 1 << FFT_MAX,
                "Poly: LIM_POLY <= 1 << FFT_MAX must hold.");
  static Mint polyWork0[LIM_POLY], polyWork1[LIM_POLY], polyWork2[LIM_POLY],
      polyWork3[LIM_POLY];
  struct Poly : public vector<Mint> {
    Poly() {}
    explicit Poly(int n) : vector<Mint>(n) {}
    Poly(const vector<Mint> &vec) : vector<Mint>(vec) {}
    Poly(std::initializer_list<Mint> il) : vector<Mint>(il) {}
    int size() const { return vector<Mint>::size(); }
    Mint at(long long k) const {
      return (0 <= k && k < size()) ? (*this)[k] : 0U;
    }
    int ord() const {
      for (int i = 0; i < size(); ++i)
        if ((*this)[i]) return i;
      return -1;
    }
    int deg() const {
      for (int i = size(); --i >= 0;)
        if ((*this)[i]) return i;
      return -1;
    }
    Poly mod(int n) const {
      return Poly(vector<Mint>(data(), data() + min(n, size())));
    }
    friend std::ostream &operator<<(std::ostream &os, const Poly &fs) {
      os << "[";
      for (int i = 0; i < fs.size(); ++i) {
        if (i > 0) os << ", ";
        os << fs[i];
      }
      return os << "]";
    }
    Poly &operator+=(const Poly &fs) {
      if (size() < fs.size()) resize(fs.size());
      for (int i = 0; i < fs.size(); ++i) (*this)[i] += fs[i];
      return *this;
    }
    Poly &operator-=(const Poly &fs) {
      if (size() < fs.size()) resize(fs.size());
      for (int i = 0; i < fs.size(); ++i) (*this)[i] -= fs[i];
      return *this;
    }
    Poly &operator*=(const Poly &fs) {
      if (empty() || fs.empty()) return *this = {};
      const int nt = size(), nf = fs.size();
      int n = 1;
      for (; n < nt + nf - 1; n <<= 1) {
      }
      assert(n <= LIM_POLY);
      resize(n);
      fft(data(), n);
      memcpy(polyWork0, fs.data(), nf * sizeof(Mint));
      memset(polyWork0 + nf, 0, (n - nf) * sizeof(Mint));
      fft(polyWork0, n);
      for (int i = 0; i < n; ++i) (*this)[i] *= polyWork0[i];
      invFft(data(), n);
      resize(nt + nf - 1);
      return *this;
    }
    Poly &operator/=(const Poly &fs) {
      const int m = deg(), n = fs.deg();
      assert(n != -1);
      if (m < n) return *this = {};
      Poly tsRev(m - n + 1), fsRev(min(m - n, n) + 1);
      for (int i = 0; i <= m - n; ++i) tsRev[i] = (*this)[m - i];
      for (int i = 0, i0 = min(m - n, n); i <= i0; ++i) fsRev[i] = fs[n - i];
      const Poly qsRev = tsRev.div(fsRev, m - n + 1);
      resize(m - n + 1);
      for (int i = 0; i <= m - n; ++i) (*this)[i] = qsRev[m - n - i];
      return *this;
    }
    Poly &operator%=(const Poly &fs) {
      const Poly qs = *this / fs;
      *this -= fs * qs;
      resize(deg() + 1);
      return *this;
    }
    Poly &operator*=(const Mint &a) {
      for (int i = 0; i < size(); ++i) (*this)[i] *= a;
      return *this;
    }
    Poly &operator/=(const Mint &a) {
      const Mint b = a.inv();
      for (int i = 0; i < size(); ++i) (*this)[i] *= b;
      return *this;
    }
    Poly operator+() const { return *this; }
    Poly operator-() const {
      Poly fs(size());
      for (int i = 0; i < size(); ++i) fs[i] = -(*this)[i];
      return fs;
    }
    Poly operator+(const Poly &fs) const { return (Poly(*this) += fs); }
    Poly operator-(const Poly &fs) const { return (Poly(*this) -= fs); }
    Poly operator*(const Poly &fs) const { return (Poly(*this) *= fs); }
    Poly operator/(const Poly &fs) const { return (Poly(*this) /= fs); }
    Poly operator%(const Poly &fs) const { return (Poly(*this) %= fs); }
    Poly operator*(const Mint &a) const { return (Poly(*this) *= a); }
    Poly operator/(const Mint &a) const { return (Poly(*this) /= a); }
    friend Poly operator*(const Mint &a, const Poly &fs) { return fs * a; }
    Poly inv(int n) const {
      assert(!empty());
      assert((*this)[0]);
      assert(1 <= n);
      assert(n == 1 || 1 << (32 - __builtin_clz(n - 1)) <= LIM_POLY);
      Poly fs(n);
      fs[0] = (*this)[0].inv();
      for (int m = 1; m < n; m <<= 1) {
        memcpy(polyWork0, data(), min(m << 1, size()) * sizeof(Mint));
        memset(polyWork0 + min(m << 1, size()), 0,
               ((m << 1) - min(m << 1, size())) * sizeof(Mint));
        fft(polyWork0, m << 1);
        memcpy(polyWork1, fs.data(), min(m << 1, n) * sizeof(Mint));
        memset(polyWork1 + min(m << 1, n), 0,
               ((m << 1) - min(m << 1, n)) * sizeof(Mint));
        fft(polyWork1, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork1[i];
        invFft(polyWork0, m << 1);
        memset(polyWork0, 0, m * sizeof(Mint));
        fft(polyWork0, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork1[i];
        invFft(polyWork0, m << 1);
        for (int i = m, i0 = min(m << 1, n); i < i0; ++i) fs[i] = -polyWork0[i];
      }
      return fs;
    }
    Poly div(const Poly &fs, int n) const {
      assert(!fs.empty());
      assert(fs[0]);
      assert(1 <= n);
      if (n == 1) return {at(0) / fs[0]};
      const int m = 1 << (31 - __builtin_clz(n - 1));
      assert(m << 1 <= LIM_POLY);
      Poly gs = fs.inv(m);
      gs.resize(m << 1);
      fft(gs.data(), m << 1);
      memcpy(polyWork0, data(), min(m, size()) * sizeof(Mint));
      memset(polyWork0 + min(m, size()), 0,
             ((m << 1) - min(m, size())) * sizeof(Mint));
      fft(polyWork0, m << 1);
      for (int i = 0; i < m << 1; ++i) polyWork0[i] *= gs[i];
      invFft(polyWork0, m << 1);
      Poly hs(n);
      memcpy(hs.data(), polyWork0, m * sizeof(Mint));
      memset(polyWork0 + m, 0, m * sizeof(Mint));
      fft(polyWork0, m << 1);
      memcpy(polyWork1, fs.data(), min(m << 1, fs.size()) * sizeof(Mint));
      memset(polyWork1 + min(m << 1, fs.size()), 0,
             ((m << 1) - min(m << 1, fs.size())) * sizeof(Mint));
      fft(polyWork1, m << 1);
      for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork1[i];
      invFft(polyWork0, m << 1);
      memset(polyWork0, 0, m * sizeof(Mint));
      for (int i = m, i0 = min(m << 1, size()); i < i0; ++i)
        polyWork0[i] -= (*this)[i];
      fft(polyWork0, m << 1);
      for (int i = 0; i < m << 1; ++i) polyWork0[i] *= gs[i];
      invFft(polyWork0, m << 1);
      for (int i = m; i < n; ++i) hs[i] = -polyWork0[i];
      return hs;
    }
    Mint divAt(const Poly &fs, long long k) const {
      assert(k >= 0);
      if (size() >= fs.size()) {
        assert(false);
      }
      int h = 0, m = 1;
      for (; m < fs.size(); ++h, m <<= 1) {
      }
      if (k < m) {
        const Poly gs = fs.inv(k + 1);
        Mint sum;
        for (int i = 0, i0 = min<int>(k + 1, size()); i < i0; ++i)
          sum += (*this)[i] * gs[k - i];
        return sum;
      }
      assert(m << 1 <= LIM_POLY);
      polyWork0[0] = Mint(2U).inv();
      for (int hh = 0; hh < h; ++hh)
        for (int i = 0; i < 1 << hh; ++i)
          polyWork0[1 << hh | i] = polyWork0[i] * INV_FFT_ROOTS[hh + 2];
      const Mint a = FFT_ROOTS[h + 1];
      memcpy(polyWork2, data(), size() * sizeof(Mint));
      memset(polyWork2 + size(), 0, ((m << 1) - size()) * sizeof(Mint));
      fft(polyWork2, m << 1);
      memcpy(polyWork1, fs.data(), fs.size() * sizeof(Mint));
      memset(polyWork1 + fs.size(), 0, ((m << 1) - fs.size()) * sizeof(Mint));
      fft(polyWork1, m << 1);
      for (;;) {
        if (k & 1) {
          for (int i = 0; i < m; ++i)
            polyWork2[i] =
                polyWork0[i] * (polyWork2[i << 1 | 0] * polyWork1[i << 1 | 1] -
                                polyWork2[i << 1 | 1] * polyWork1[i << 1 | 0]);
        } else {
          for (int i = 0; i < m; ++i) {
            polyWork2[i] = polyWork2[i << 1 | 0] * polyWork1[i << 1 | 1] +
                           polyWork2[i << 1 | 1] * polyWork1[i << 1 | 0];
            polyWork2[i].x =
                ((polyWork2[i].x & 1) ? (polyWork2[i].x + MO) : polyWork2[i].x) >>
                1;
          }
        }
        for (int i = 0; i < m; ++i)
          polyWork1[i] = polyWork1[i << 1 | 0] * polyWork1[i << 1 | 1];
        if ((k >>= 1) < m) {
          invFft(polyWork2, m);
          invFft(polyWork1, m);
          const Poly gs =
              Poly(vector<Mint>(polyWork1, polyWork1 + k + 1)).inv(k + 1);
          Mint sum;
          for (int i = 0; i <= k; ++i) sum += polyWork2[i] * gs[k - i];
          return sum;
        }
        memcpy(polyWork2 + m, polyWork2, m * sizeof(Mint));
        invFft(polyWork2 + m, m);
        memcpy(polyWork1 + m, polyWork1, m * sizeof(Mint));
        invFft(polyWork1 + m, m);
        Mint aa = 1;
        for (int i = m; i < m << 1; ++i) {
          polyWork2[i] *= aa;
          polyWork1[i] *= aa;
          aa *= a;
        }
        fft(polyWork2 + m, m);
        fft(polyWork1 + m, m);
      }
    }
    Poly log(int n) const {
      assert(!empty());
      assert((*this)[0].x == 1U);
      assert(n <= LIM_INV);
      Poly fs = mod(n);
      for (int i = 0; i < fs.size(); ++i) fs[i] *= i;
      fs = fs.div(*this, n);
      for (int i = 1; i < n; ++i) fs[i] *= ::inv[i];
      return fs;
    }
    Poly exp(int n) const {
      assert(!empty());
      assert(!(*this)[0]);
      assert(1 <= n);
      assert(n == 1 ||
             1 << (32 - __builtin_clz(n - 1)) <= min(LIM_INV, LIM_POLY));
      if (n == 1) return {1U};
      if (n == 2) return {1U, at(1)};
      Poly fs(n);
      fs[0].x = polyWork1[0].x = polyWork1[1].x = polyWork2[0].x = 1U;
      int m;
      for (m = 1; m << 1 < n; m <<= 1) {
        for (int i = 0, i0 = min(m, size()); i < i0; ++i)
          polyWork0[i] = i * (*this)[i];
        memset(polyWork0 + min(m, size()), 0,
               (m - min(m, size())) * sizeof(Mint));
        fft(polyWork0, m);
        for (int i = 0; i < m; ++i) polyWork0[i] *= polyWork1[i];
        invFft(polyWork0, m);
        for (int i = 0; i < m; ++i) polyWork0[i] -= i * fs[i];
        memset(polyWork0 + m, 0, m * sizeof(Mint));
        fft(polyWork0, m << 1);
        memcpy(polyWork3, polyWork2, m * sizeof(Mint));
        memset(polyWork3 + m, 0, m * sizeof(Mint));
        fft(polyWork3, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork3[i];
        invFft(polyWork0, m << 1);
        for (int i = 0; i < m; ++i) polyWork0[i] *= ::inv[m + i];
        for (int i = 0, i0 = min(m, size() - m); i < i0; ++i)
          polyWork0[i] += (*this)[m + i];
        memset(polyWork0 + m, 0, m * sizeof(Mint));
        fft(polyWork0, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork1[i];
        invFft(polyWork0, m << 1);
        memcpy(fs.data() + m, polyWork0, m * sizeof(Mint));
        memcpy(polyWork1, fs.data(), (m << 1) * sizeof(Mint));
        memset(polyWork1 + (m << 1), 0, (m << 1) * sizeof(Mint));
        fft(polyWork1, m << 2);
        for (int i = 0; i < m << 1; ++i)
          polyWork0[i] = polyWork1[i] * polyWork3[i];
        invFft(polyWork0, m << 1);
        memset(polyWork0, 0, m * sizeof(Mint));
        fft(polyWork0, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork3[i];
        invFft(polyWork0, m << 1);
        for (int i = m; i < m << 1; ++i) polyWork2[i] = -polyWork0[i];
      }
      for (int i = 0, i0 = min(m, size()); i < i0; ++i)
        polyWork0[i] = i * (*this)[i];
      memset(polyWork0 + min(m, size()), 0, (m - min(m, size())) * sizeof(Mint));
      fft(polyWork0, m);
      for (int i = 0; i < m; ++i) polyWork0[i] *= polyWork1[i];
      invFft(polyWork0, m);
      for (int i = 0; i < m; ++i) polyWork0[i] -= i * fs[i];
      memcpy(polyWork0 + m, polyWork0 + (m >> 1), (m >> 1) * sizeof(Mint));
      memset(polyWork0 + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      memset(polyWork0 + m + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      fft(polyWork0, m);
      fft(polyWork0 + m, m);
      memcpy(polyWork3 + m, polyWork2 + (m >> 1), (m >> 1) * sizeof(Mint));
      memset(polyWork3 + m + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      fft(polyWork3 + m, m);
      for (int i = 0; i < m; ++i)
        polyWork0[m + i] =
            polyWork0[i] * polyWork3[m + i] + polyWork0[m + i] * polyWork3[i];
      for (int i = 0; i < m; ++i) polyWork0[i] *= polyWork3[i];
      invFft(polyWork0, m);
      invFft(polyWork0 + m, m);
      for (int i = 0; i < m >> 1; ++i)
        polyWork0[(m >> 1) + i] += polyWork0[m + i];
      for (int i = 0; i < m; ++i) polyWork0[i] *= ::inv[m + i];
      for (int i = 0, i0 = min(m, size() - m); i < i0; ++i)
        polyWork0[i] += (*this)[m + i];
      memset(polyWork0 + m, 0, m * sizeof(Mint));
      fft(polyWork0, m << 1);
      for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork1[i];
      invFft(polyWork0, m << 1);
      memcpy(fs.data() + m, polyWork0, (n - m) * sizeof(Mint));
      return fs;
    }
    Poly pow(Mint a, int n) const {
      assert(!empty());
      assert((*this)[0].x == 1U);
      assert(1 <= n);
      return (a * log(n)).exp(n);
    }
    Poly pow(long long a, int n) const {
      assert(a >= 0);
      assert(1 <= n);
      if (a == 0) {
        Poly gs(n);
        gs[0].x = 1U;
        return gs;
      }
      const int o = ord();
      if (o == -1 || o > (n - 1) / a) return Poly(n);
      const Mint b = (*this)[o].inv(), c = (*this)[o].pow(a);
      const int ntt = min<int>(n - a * o, size() - o);
      Poly tts(ntt);
      for (int i = 0; i < ntt; ++i) tts[i] = b * (*this)[o + i];
      tts = tts.pow(Mint(a), n - a * o);
      Poly gs(n);
      for (int i = 0; i < n - a * o; ++i) gs[a * o + i] = c * tts[i];
      return gs;
    }
    Poly sqrt(int n) const {
      assert(!empty());
      assert((*this)[0].x == 1U);
      assert(1 <= n);
      assert(n == 1 || 1 << (32 - __builtin_clz(n - 1)) <= LIM_POLY);
      if (n == 1) return {1U};
      if (n == 2) return {1U, at(1) / 2};
      Poly fs(n);
      fs[0].x = polyWork1[0].x = polyWork2[0].x = 1U;
      int m;
      for (m = 1; m << 1 < n; m <<= 1) {
        for (int i = 0; i < m; ++i) polyWork1[i] *= polyWork1[i];
        invFft(polyWork1, m);
        for (int i = 0, i0 = min(m, size()); i < i0; ++i)
          polyWork1[i] -= (*this)[i];
        for (int i = 0, i0 = min(m, size() - m); i < i0; ++i)
          polyWork1[i] -= (*this)[m + i];
        memset(polyWork1 + m, 0, m * sizeof(Mint));
        fft(polyWork1, m << 1);
        memcpy(polyWork3, polyWork2, m * sizeof(Mint));
        memset(polyWork3 + m, 0, m * sizeof(Mint));
        fft(polyWork3, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork1[i] *= polyWork3[i];
        invFft(polyWork1, m << 1);
        for (int i = 0; i < m; ++i) {
          polyWork1[i] = -polyWork1[i];
          fs[m + i].x =
              ((polyWork1[i].x & 1) ? (polyWork1[i].x + MO) : polyWork1[i].x) >>
              1;
        }
        memcpy(polyWork1, fs.data(), (m << 1) * sizeof(Mint));
        fft(polyWork1, m << 1);
        for (int i = 0; i < m << 1; ++i)
          polyWork0[i] = polyWork1[i] * polyWork3[i];
        invFft(polyWork0, m << 1);
        memset(polyWork0, 0, m * sizeof(Mint));
        fft(polyWork0, m << 1);
        for (int i = 0; i < m << 1; ++i) polyWork0[i] *= polyWork3[i];
        invFft(polyWork0, m << 1);
        for (int i = m; i < m << 1; ++i) polyWork2[i] = -polyWork0[i];
      }
      for (int i = 0; i < m; ++i) polyWork1[i] *= polyWork1[i];
      invFft(polyWork1, m);
      for (int i = 0, i0 = min(m, size()); i < i0; ++i)
        polyWork1[i] -= (*this)[i];
      for (int i = 0, i0 = min(m, size() - m); i < i0; ++i)
        polyWork1[i] -= (*this)[m + i];
      memcpy(polyWork1 + m, polyWork1 + (m >> 1), (m >> 1) * sizeof(Mint));
      memset(polyWork1 + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      memset(polyWork1 + m + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      fft(polyWork1, m);
      fft(polyWork1 + m, m);
      memcpy(polyWork3 + m, polyWork2 + (m >> 1), (m >> 1) * sizeof(Mint));
      memset(polyWork3 + m + (m >> 1), 0, (m >> 1) * sizeof(Mint));
      fft(polyWork3 + m, m);
      for (int i = 0; i < m; ++i)
        polyWork1[m + i] =
            polyWork1[i] * polyWork3[m + i] + polyWork1[m + i] * polyWork3[i];
      for (int i = 0; i < m; ++i) polyWork1[i] *= polyWork3[i];
      invFft(polyWork1, m);
      invFft(polyWork1 + m, m);
      for (int i = 0; i < m >> 1; ++i)
        polyWork1[(m >> 1) + i] += polyWork1[m + i];
      for (int i = 0; i < n - m; ++i) {
        polyWork1[i] = -polyWork1[i];
        fs[m + i].x =
            ((polyWork1[i].x & 1) ? (polyWork1[i].x + MO) : polyWork1[i].x) >> 1;
      }
      return fs;
    }
    template <class F>
    Poly sqrt(int n, F modSqrt) const {
      assert(1 <= n);
      const int o = ord();
      if (o == -1) return Poly(n);
      if (o & 1) return {};
      const Mint c = modSqrt((*this)[o]);
      if (c * c != (*this)[o]) return {};
      if (o >> 1 >= n) return Poly(n);
      const Mint b = (*this)[o].inv();
      const int ntt = min(n - (o >> 1), size() - o);
      Poly tts(ntt);
      for (int i = 0; i < ntt; ++i) tts[i] = b * (*this)[o + i];
      tts = tts.sqrt(n - (o >> 1));
      Poly gs(n);
      for (int i = 0; i < n - (o >> 1); ++i) gs[(o >> 1) + i] = c * tts[i];
      return gs;
    }
  };
  Mint linearRecurrenceAt(const vector<Mint> &as, const vector<Mint> &cs,
                          long long k) {
    assert(!cs.empty());
    assert(cs[0]);
    const int d = cs.size() - 1;
    assert(as.size() >= static_cast<size_t>(d));
    return (Poly(vector<Mint>(as.begin(), as.begin() + d)) * cs)
        .mod(d)
        .divAt(cs, k);
  }
  struct SubproductTree {
    int logN, n, nn;
    vector<Mint> xs;
    vector<Mint> buf;
    vector<Mint *> gss;
    Poly all;
    SubproductTree(const vector<Mint> &xs_) {
      n = xs_.size();
      for (logN = 0, nn = 1; nn < n; ++logN, nn <<= 1) {
      }
      xs.assign(nn, 0U);
      memcpy(xs.data(), xs_.data(), n * sizeof(Mint));
      buf.assign((logN + 1) * (nn << 1), 0U);
      gss.assign(nn << 1, nullptr);
      for (int h = 0; h <= logN; ++h)
        for (int u = 1 << h; u < 1 << (h + 1); ++u) {
          gss[u] =
              buf.data() + (h * (nn << 1) + ((u - (1 << h)) << (logN - h + 1)));
        }
      for (int i = 0; i < nn; ++i) {
        gss[nn + i][0] = -xs[i] + 1;
        gss[nn + i][1] = -xs[i] - 1;
      }
      if (nn == 1) gss[1][1] += 2;
      for (int h = logN; --h >= 0;) {
        const int m = 1 << (logN - h);
        for (int u = 1 << (h + 1); --u >= 1 << h;) {
          for (int i = 0; i < m; ++i)
            gss[u][i] = gss[u << 1][i] * gss[u << 1 | 1][i];
          memcpy(gss[u] + m, gss[u], m * sizeof(Mint));
          invFft(gss[u] + m, m);
          if (h > 0) {
            gss[u][m] -= 2;
            const Mint a = FFT_ROOTS[logN - h + 1];
            Mint aa = 1;
            for (int i = m; i < m << 1; ++i) {
              gss[u][i] *= aa;
              aa *= a;
            };
            fft(gss[u] + m, m);
          }
        }
      }
      all.resize(nn + 1);
      all[0] = 1;
      for (int i = 1; i < nn; ++i) all[i] = gss[1][nn + nn - i];
      all[nn] = gss[1][nn] - 1;
    }
    vector<Mint> multiEval(const Poly &fs) const {
      vector<Mint> work0(nn), work1(nn), work2(nn);
      {
        const int m = max(fs.size(), 1);
        auto invAll = all.inv(m);
        std::reverse(invAll.begin(), invAll.end());
        int mm;
        for (mm = 1; mm < m - 1 + nn; mm <<= 1) {
        }
        invAll.resize(mm, 0U);
        fft(invAll);
        vector<Mint> ffs(mm, 0U);
        memcpy(ffs.data(), fs.data(), fs.size() * sizeof(Mint));
        fft(ffs);
        for (int i = 0; i < mm; ++i) ffs[i] *= invAll[i];
        invFft(ffs);
        memcpy(((logN & 1) ? work1 : work0).data(), ffs.data() + m - 1,
               nn * sizeof(Mint));
      }
      for (int h = 0; h < logN; ++h) {
        const int m = 1 << (logN - h);
        for (int u = 1 << h; u < 1 << (h + 1); ++u) {
          Mint *hs = (((logN - h) & 1) ? work1 : work0).data() +
                     ((u - (1 << h)) << (logN - h));
          Mint *hs0 = (((logN - h) & 1) ? work0 : work1).data() +
                      ((u - (1 << h)) << (logN - h));
          Mint *hs1 = hs0 + (m >> 1);
          fft(hs, m);
          for (int i = 0; i < m; ++i) work2[i] = gss[u << 1 | 1][i] * hs[i];
          invFft(work2.data(), m);
          memcpy(hs0, work2.data() + (m >> 1), (m >> 1) * sizeof(Mint));
          for (int i = 0; i < m; ++i) work2[i] = gss[u << 1][i] * hs[i];
          invFft(work2.data(), m);
          memcpy(hs1, work2.data() + (m >> 1), (m >> 1) * sizeof(Mint));
        }
      }
      work0.resize(n);
      return work0;
    }
    Poly interpolate(const vector<Mint> &ys) const {
      assert(static_cast<int>(ys.size()) == n);
      Poly gs(n);
      for (int i = 0; i < n; ++i) gs[i] = (i + 1) * all[n - (i + 1)];
      const vector<Mint> denoms = multiEval(gs);
      vector<Mint> work(nn << 1, 0U);
      for (int i = 0; i < n; ++i) {
        assert(denoms[i]);
        work[i << 1] = work[i << 1 | 1] = ys[i] / denoms[i];
      }
      for (int h = logN; --h >= 0;) {
        const int m = 1 << (logN - h);
        for (int u = 1 << (h + 1); --u >= 1 << h;) {
          Mint *hs = work.data() + ((u - (1 << h)) << (logN - h + 1));
          for (int i = 0; i < m; ++i)
            hs[i] = gss[u << 1 | 1][i] * hs[i] + gss[u << 1][i] * hs[m + i];
          if (h > 0) {
            memcpy(hs + m, hs, m * sizeof(Mint));
            invFft(hs + m, m);
            const Mint a = FFT_ROOTS[logN - h + 1];
            Mint aa = 1;
            for (int i = m; i < m << 1; ++i) {
              hs[i] *= aa;
              aa *= a;
            };
            fft(hs + m, m);
          }
        }
      }
      invFft(work.data(), nn);
      return Poly(vector<Mint>(work.data() + nn - n, work.data() + nn));
    }
  };
  pair<Poly, Mint> solve(int N, Int M) {
    pair<Poly, Mint> ret;
    Poly &path = ret.first;
    Mint &cycle = ret.second = 0;
    if (M == 1) {
      path.resize(N + 1);
      for (int i = 0; i <= N; ++i) {
        path[i] = 1;
      }
      cycle = 1;
    } else {
      auto res = solve(N, M / 2);
      res.first[1] = M - M / 2;
      Poly fs(N + 1);
      fs[0] += 1;
      for (int i = 1; i <= N; i += 2) {
        fs[i] -= res.first[i];
      }
      fs = fs.inv(N + 1);
      Poly es(N + 1);
      for (int i = 2; i <= N; i += 2) {
        es[i] += res.first[i];
      }
      Poly fes = fs * es;
      fes.resize(N + 1);
      path += fs;
      path += 2 * fes;
      path += (fes * es).mod(N + 1);
      for (int i = 1; i <= N; i += 2) {
        path[i] += res.first[i];
      }
      if (N % 2 == 0) {
        cycle += 2 * res.second;
      }
      cycle += (M - M / 2) * fs[N - 1];
      for (int i = 3; i <= N; i += 2) {
        cycle += i * res.first[i] * fs[N - i];
      }
    }
    return ret;
  }
  int a[100];
  int n, m;
  void dfs(int k) {
    if (k == n) {
      if (a[n - 1] + a[0] < m) {
        for (int i = 0; i < n; ++i) {
          cout << a[i] << " ";
        }
        cout << endl;
      }
    } else {
      int up = k ? m - a[k - 1] : m;
      for (int i = 0; i < up; ++i) {
        a[k] = i;
        dfs(k + 1);
      }
    }
  }
  int main() {
    int N;
    Int M;
    for (; ~scanf("%d%lld", &N, &M);) {
      n = N;
      m = M;
      const auto res = solve(N, M);
      printf("%u\n", res.second.x);
    }
    return 0;
  }
  