#include <bits/stdc++.h>
      
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second

using namespace std;

using ld = long double;
using ll = long long int;

const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ll MOD = 998244353;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

// head

struct Mod{
  unsigned n;
  Mod() : n(0){}
  Mod( ll x ){
    if( x < 0 ) n = x%MOD+MOD;
    else n = x%MOD;
  }
};
Mod operator + ( Mod a  , Mod b ){ return Mod( a.n + b.n ); }
Mod operator +=( Mod &a , Mod b ){ return a = a + b; }
Mod operator - ( Mod a ){ return Mod( MOD - a.n ); }
Mod operator - ( Mod a  , Mod b ){ return Mod( a.n + MOD - b.n ); }
Mod operator -=( Mod &a , Mod b ){ return a = a - b; }
Mod operator * ( Mod a  , Mod b ){ return Mod( (ll)a.n * b.n ); }
Mod operator *=( Mod &a , Mod b ){ return a = a * b; }
Mod modpow( Mod x , ll k ){
  Mod res = 1;
  while( k ){
    if( k & 1 ) res *= x;
    k /= 2;
    x *= x;
  }
  return res;
}
ll extgcd( ll a , ll b , ll &x , ll &y ){
  ll d = a;
  if( b != 0 ){
    d = extgcd( b , a % b , y , x );
    y -= a / b * x;
  } else {
    x = 1, y = 0;
  }
  return d;
}
Mod inv( Mod a ){ ll x, y; assert( extgcd( a.n , MOD , x , y ) == 1 ); return Mod( x ); }
Mod operator / ( Mod a  , Mod b ){ return Mod( (ll)a.n * inv(b).n ); }
Mod operator /=( Mod &a , Mod b ){ return a = a / b; }

typedef vector<Mod> vec;
typedef vector<vec> mat;

inline mat zero_mat( int n , int m ){ return mat( n , vec( m , 0 ) ); }
inline mat zero_mat( int n ){ return zero_mat( n , n ); }
inline mat id_mat( int n ){
  mat res = zero_mat( n );
  REP( i , n ) res[i][i] = 1;
  return res;
}
mat transpose( mat a ){
  mat b = zero_mat( SZ(a[0]) , SZ(a) );
  REP( i , SZ(a) ) REP( j , SZ(a[i]) ) b[j][i] = a[i][j];
  return b;
}
mat operator +( mat a , mat b ){
  assert( SZ(a) == SZ(b) );
  assert( SZ(a[0]) == SZ(b[0]) );
  REP( i , SZ(a) ) REP( j , SZ(a[i]) ) a[i][j] += b[i][j];
  return a;
}
mat operator +=( mat &a , mat b ){
  return a = a + b;
}
mat operator -( mat a ){
  REP( i , SZ(a) ) REP( j , SZ(a[i]) ) a[i][j] = -a[i][j];
  return a;
}
mat operator -( mat a , mat b ){
  return a + ( - b );
}
mat operator -=( mat &a , mat b ){
  return a = a - b;
}
mat operator *( mat a , mat b ){
  assert( SZ(a[0]) == SZ(b) );
  mat c = zero_mat( SZ(a) , SZ(b[0]) );
  REP( i , SZ(c) ) REP( j , SZ(c[i]) ) REP( k , SZ(a[i]) ) c[i][j] = c[i][j] + a[i][k]*b[k][j];
  return c;
}
mat operator *=( mat &a , mat b ){
  return a = a * b;
}
mat operator *( Mod a , mat b ){
  REP( i , SZ(b) ) REP( j , SZ(b[i]) ) b[i][j] *= a;
  return b;
}
mat AugmentedMatrix( mat A , vec b ){
  assert( SZ(A) == SZ(b) );
  REP( i , SZ(A) ){
    A[i].pb( b[i] );
  }
  return A;
}
mat pow( mat x , ll k ){
  assert( SZ(x) == SZ(x[0]) );
  mat res = id_mat( SZ(x) );
  while( k ){
    if( k % 2 == 1 ){
      res *= x;
    }
    k /= 2;
    x *= x;
  }
  return res;
}

template<class T>
struct Kitamasa{
  Kitamasa(){}
  vector<T> a, d;
  int k;
  void init(vector<T> initial, vector<T> coef){
    a = initial;
    d = coef;
    assert(SZ(a) == SZ(d));
    k = SZ(a);
  }
  vector<T> mult(vector<T> x, vector<T> y){
    vector<T> c(2*k, 0);
    REP(i , k) REP(j, k) c[i+j] += x[i] * y[j];
    for(int i = 2*k-1; i >= k; i--) REP(j, k) c[i-k+j] += c[i] * d[j];
    c.resize( k );
    return c;
  }
  T calc(ll n){
    vector<T> v(k, 0); v[1] = 1;
    vector<T> res(k, 0); res[0] = 1;
    while(n > 0){
      if(n % 2 == 1) res = mult(res, v);
      v = mult(v, v);
      n /= 2;
    }
    T ans = 0;
    REP(i, k){
      ans += res[i] * a[i];
    }
    return ans;
  }
};

Kitamasa<Mod> kitamasa;

Mod fib(ll n){
  return kitamasa.calc(n);
  mat A = zero_mat(2);
  A[0][0] = 1; A[0][1] = 1;
  A[1][0] = 1; A[1][1] = 0;
  mat res = pow(A, n);
  return res[1][0];
}

Mod solve(ll n, ll m){
  if(n == 1){
    return fib(m);
  }
  Mod res = fib(m + 2 * n - 2);
  Mod cur = 1;
  ll p = 0;
  for(ll i = n-1; i >= 1; i--){
    res -= fib(2 * i) * cur;
    cur *= (Mod)(m + p) / (p + 1);
    p++;
  }
  return res.n;
}

int main(){

  vector<Mod> a(2); a[0] = 0; a[1] = 1;
  vector<Mod> coef(2); coef[0] = 1; coef[1] = 1;
  
  kitamasa.init(a, coef);
  
  /*
  FOR(i, 1, 5){
    FOR(j, 1, 8){
      Mod res = solve(i, j);
      cout << res.n << " ";
    }
    cout << endl;
  }
  return 0;
  */

  ll n = in();
  ll m = in();
  cout << solve(n, m).n << endl;
  
  return 0;
}


Measured memory_bytes: 256