#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=998244353;

ll modpow(ll r,ll n,ll m=MOD){
  ll re=1,d=r%m;
  if(n<0)(n%=MOD-1)+=MOD-1;
  for(;n;n/=2){
    if(n&1)(re*=d)%=m;
    (d*=d)%=m;
  }
  return re;
}
vector<ll> fact,finv,inv;
ll comb(ll n,ll r){
  if(n<r||r<0)return 0;
  return fact[n]*finv[n-r]%MOD*finv[r]%MOD;
}
class Doralion{
  void Modinvs(vector<ll> &re,int n){
    re.resize(n+1); re[1]=1;
    for(int i=2;i<=n;++i)re[i]=re[MOD%i]*(MOD-MOD/i)%MOD;
  }
  void Facts(vector<ll> &re,int n){
    re.resize(n+1); re[0]=1;
    rep(i,n)re[i+1]=re[i]*(i+1)%MOD;
  }
  void Factinvs(vector<ll> &re,const vector<ll> &inv,int n){
    re.resize(n+1); re[0]=1;
    rep(i,n)re[i+1]=re[i]*inv[i+1]%MOD;
  }
public:
  Doralion(int n){
    Modinvs(inv,n);
    Facts(fact,n);
    Factinvs(finv,inv,n);
  }
} doralion(212345);

pll modFibPair(ll i,ll q){
  if(!i)
    return pll(0,1);
  if(i%2){
    pll f=modFibPair(i/2,q);
    ll a=f.X,b=f.Y,c=(a+b)%q;
    return pll((a*a%q+b*b%q)%q,(a*b%q+b*c%q)%q);
  }else{
    pll f=modFibPair(i-1,q);
    return pll(f.Y, (f.X+f.Y)%q);
  }
}

ll modFib(ll i,ll q=MOD){
  return modFibPair(i%(MOD*2+2),q).X%MOD;
}

ll fun(ll n,ll m){
  vector<ll> fib(2*n);
  fib[1]=1;
  reps(i,2,2*n) fib[i]=(fib[i-1]+fib[i-2])%MOD;
  ll re=modFib(m%(MOD*2+2)+2*(n-1));
  ll cb=1;
  m%=MOD;
  rep(i,n-1){//cout<<pll(modFib(2*(n-1-i)),comb(i+m-1,i));
    re+=MOD-cb*fib[2*(n-1-i)]%MOD;
    (cb*=m+i)%=MOD;
    (cb*=inv[i+1])%=MOD;
  }//cout<<endl;
  return re%MOD;
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  //cout<<modFib(MOD*2+2)<<","<<modFib(MOD*2+3)<<endl;
  //reps(i,-2,3) cout<<modFib(MOD+i)<<",";cout<<endl;
  // cout<<fun(2,4)<<endl;
  // reps(i,1,5){
  //   reps(j,1,8){
  //     cout<<fun(i,j)<<",";
  //   }
  //   cout<<endl;
  // }
  ll n,m;
  cin>>n>>m;
  cout<<fun(n,m)<<endl;
  return 0;
}


Measured memory_bytes: 8320