#include using namespace std; using ll=long long; #include using namespace atcoder; using mints=modint998244353; #pragma GCC target ("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++) #define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define moda 998244353LL #define modb 1000000007LL #define gyaku 166374059LL #define dai 2500000000000000000LL #define sho -dai #define aoi 1e+18 #define tyu 2500000000 #define giri 1000000000 #define en 3.14159265358979 #define eps 1e-14 #define endl '\n' #define yn(x) cout<<(x?"Yes\n":"No\n"); #define YN(x) cout<<(x?"YES\n":"NO\n"); #define ci(x) cin>>x; #define fi(x) cout<; using ip=pair; using mint=modint; using minto=modint1000000007; using vi=vector; using ivi=vector; using vd=vector; using vs=vector; using vc=vector; using vb=vector; using vp=vector

; using ivp=vector; using vm=vector; using vms=vector; using vmo=vector; using sp=set

; using isp=set; using ss=set; using sc=set; using si=set; using isi=set; using svi=set; using vvi=vector; using ivvi=vector; using vvd=vector; using vvs=vector; using vvb=vector; using vvc=vector; using vvp=vector; using ivvp=vector; using vvm=vector; using vvms=vector; using vvmo=vector; using vsi=vector; using ivsi=vector; using vsp=vector; using ivsp=vector; using vvsi=vector; using ivvsi=vector; using vvsp=vector; using ivvsp=vector; using vvvi=vector; using ivvvi=vector; using vvvd=vector; using vvvb=vector; using vvvm=vector; using vvvms=vector; using vvvmo=vector; using vvvvi=vector; using ivvvvi=vector; const it dx[4]={0,1,0,-1}; const it dy[4]={1,0,-1,0}; template void scan(vector &a){ rep(i,0,a.size()-1)cin>>a[i]; } template void scan(vector &a,vector&b){ rep(i,0,a.size()-1)cin>>a[i]>>b[i]; } template void scan(vector> &a){ rep(i,0,a.size()-1)cin>>a[i].first>>a[i].second; } template void dec(vector &a){ rep(i,0,a.size()-1)a[i]--; } it gcda(it a,it b){ //xは使わない if(!a||!b){ return max(a,b); } while(a%b&&b%a){ if(a>b)a%=b; else b%=a; } return min(a,b); } it lcma(it a,it b){ //xは使わない return a/gcda(a,b)*b; } bo su(ch c){return ('0'<=c&&c<='9');} const int MOD = modb; vector fact, fact_inv, inv; /* init_nCk :二項係数のための前処理 計算量:O(n) */ void init_nCk(int SIZE){ fact.resize(SIZE+5); fact_inv.resize(SIZE+5); inv.resize(SIZE+5); fact[0]=fact[1]=1; fact_inv[0]=fact_inv[1]=1; inv[1]=1; rep(i,2,SIZE+4){ fact[i]=fact[i-1]*i%MOD; inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD; fact_inv[i]=fact_inv[i-1]*inv[i]%MOD; } } /* nCk :MODでの二項係数を求める(前処理 int_nCk が必要) 計算量:O(1) */ int nCk(int n, int k){ assert(!(nrv)swap(ru,rv); siz[ru]+=siz[rv]; par[rv]=ru; } bool same(int u,int v){ return leader(u)==leader(v); } int size(int u){ return siz[leader(u)]; } }; struct dsu2{ ivvi par,siz;int h,w; void init(int x,int y){ h=x,w=y;par.resize(h),siz.resize(h); rep(i,0,h-1) rep(j,0,w-1)par[i].emplace_back(i*w+j); rep(i,0,h-1) rep(j,0,w-1)siz[i].emplace_back(1); } int leader(int x,int y){ if(par[x][y]==x*par[0].size()+y)return x*w+y; return par[x][y]=leader(par[x][y]/w,par[x][y]%w); } void merge(int a,int b,int c,int d){ int ru=leader(a,b),rv=leader(c,d); if(ru==rv)return; siz[ru/w][ru%w]+=siz[rv/w][rv%w]; par[rv/w][rv%w]=ru; } bool same(int a,int b,int c,int d){ return leader(a,b)==leader(c,d); } int size(int a,int b){ int ru=leader(a,b); return siz[ru/w][ru%w]; } }; vvms gyo(vvms &a,int n){ vvms g(n,vms(n)); rep(i,0,n-1) rep(j,0,n-1) rep(k,0,n-1) g[i][j]+=a[i][k]*a[k][j]; return g; } vms gyo(vvms &a,vms &b,int n){ vms g(n); rep(i,0,n-1) rep(j,0,n-1) g[i]+=a[i][j]*b[j]; return g; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); it n;cin>>n; vvms g(2,vms(2));vms h(2); g[0]={1,1};g[1]={1,0};h[0]=1; rep(i,0,59){ if(n&(1LL<