#include "bits/stdc++.h" #define Rep(i,n) for(int i=0;i> a(n,vector(m,0)); using namespace std; typedef long long ll; typedef pair P; template inline bool chmax(T& a, T b) {if(a inline bool chmin(T& a, T b) {if(a>b){a=b;return 1;}return 0;} int n; class Matrix{ public: vector> m; int height,width; Matrix(int h,int w){//sizeを指定 height = h; width = w; m.resize(h); REP(i,h){ m[i].resize(w); } } Matrix operator*(Matrix b){ int h=height; int w=b.width; int n=width; //if(n!=b.height){ //}d Matrix c(h,w); REP(i,h){ REP(j,w){ ll v=0; REP(k,n){ v+=m[i][k]*b.m[k][j]; } c.m[i][j]=v; } } return c; } Matrix operator+(Matrix b){//大きさが同じことが前提 Matrix c(height,width); REP(i,height){ REP(j,width){ c.m[i][j]=m[i][j]+b.m[i][j]; } } return c; } }; Matrix pow_mat(Matrix a,int k){ if(k==1){ return a; } if(k%2==0){ return pow_mat(a,k/2)*pow_mat(a,k/2); }else{ return pow_mat(a,k-1)*a; } } int main(){ cin >> n; Matrix a(2,2); a.m[0][0]=1; a.m[0][1]=1; a.m[1][0]=1; a.m[1][1]=0; Matrix res(2,2); res = pow_mat(a,n); put(res.m[0][0]); return 0; }