#include using namespace std; using pii = pair; using ll = long long; const int N = 2000010, MOD = 998244353, INF = 0x3f3f3f3f; int n, m, w[N]; ll k; inline ll qmi(ll a, ll b, ll c) { ll res = 1; while (b) { if (b & 1) res = res * a % c; a = a * a % c; b >>= 1; } return res; } struct mtx { vector > a; int n, m; mtx(int _n, int _m) { n = _n, m = _m; a = vector >(n + 1, vector(m + 1)); } mtx operator*(const mtx& w) const { mtx res(n, m); res.n = n, res.m = w.m; for (int k = 1; k < m + 1; k++) for (int i = 1; i < n + 1; i++) for (int j = 1; j < w.m + 1; j++) res.a[i][j] = (res.a[i][j] + a[i][k] * w.a[k][j]) % MOD; return res; } }; mtx cal(mtx st, mtx x, ll k) { mtx res = st; while (k) { if (k & 1) { res = x * res; } k >>= 1; x = x * x; } return res; } void solve() { scanf("%d%lld", &n, &k); n <<= 2; n++; mtx x(n, 1); x.a[1][1] = 1; mtx f(n, n); for (int i = 1; i < n; i++) { if (i % 4 == 1) f.a[1][i] = 4 * qmi(5, MOD - 2, MOD) % MOD; else f.a[1][i] = 3 * qmi(5, MOD - 2, MOD) % MOD; } for (int i = 1; i < n; i++) if (i % 4 != 1) f.a[2][i] = qmi(5, MOD - 2, MOD); for (int i = 2; i <= n; i++) f.a[i][i - 1] = qmi(5, MOD - 2, MOD) % MOD; auto u = cal(x, f, k); printf("%lld\n", u.a[n][1]); } int main() { int T = 1; // scanf("%d", &T); while (T--) solve(); return 0; }