#include <cstdio>
#include <cstring>

using namespace std;

typedef long long LL;

struct mat {
	LL a[2][2];
	mat() {memset(a, 0, sizeof a);}
};

const LL mod = 998244353;
LL c[1005000], f[1005000];
LL n, m;

mat operator * (mat a, mat b) {
	mat c;
	for(int i = 0; i <= 1; ++ i) for(int j = 0; j <= 1; ++ j) for(int k = 0; k <= 1; ++ k) (c.a[i][j] += a.a[i][k] * b.a[k][j] % mod) %= mod;
	return c;
}

mat ksm(mat a, LL b) {
	mat ans;
	ans.a[0][0] = 0; ans.a[0][1] = 0;
	ans.a[1][0] = 1; ans.a[1][1] = 1;
	if(b < 0) return ans;
	while(b) {
		if(b & 1) ans = ans * a;
		a = a * a;
		b >>= 1;
	}
	return ans;
}

LL ksm(LL a, LL b) {
	LL ans = 1;
	while(b) {
		if(b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans % mod;
}

int main() {
	scanf("%lld%lld", &n, &m);
	mat fib;
	fib.a[1][0] = 1, fib.a[1][1] = 1, fib.a[0][0] = 0, fib.a[0][1] = 1;
	fib = ksm(fib, m + 2 * (n - 1) - 2);
	LL ans = fib.a[1][1];
	f[1] = 1, f[2] = 1;
	for(int i = 3; i <= (n << 1) + 10; ++ i) f[i] = (f[i - 1] + f[i - 2]) % mod;
	c[0] = 1; for(int i = 1; i <= n; ++ i) c[i] = c[i - 1] * ((m - 1 + i) % mod) % mod * ksm(i, mod - 2) % mod;
	for(int i = 1; i < n; ++ i) ans = (ans - f[i << 1] * c[n - i - 1] % mod) % mod;
	printf("%lld\n", (ans + mod) % mod);
} 