#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000 template struct matrix{ vector> v; int _h,_w; matrix(vector> X){ v = X; _h = X.size(); _w = 0; if(X.size()>0)_w = X[0].size(); } matrix(int h,int w){ v.resize(h,vector(w,e0())); _h = h; _w = w; } void add_element(int from,int to,S x){ v[to][from] = op0(v[to][from],x); } matrix e(){ assert(_h==_w); matrix ret(_h,_w); for(int i=0;i<_h;i++){ for(int j=0;j<_w;j++){ if(i==j)ret.v[i][j] = e1(); else ret.v[i][j] = e0(); } } return ret; } matrix &operator*=(const matrix &another){ matrix ret(_h,another._w); for(int i=0;i<_h;i++){ for(int j=0;j ret = e(); auto temp = *this; while(cnt!=0LL){ if((cnt&1)==1){ ret *= temp; } temp *= temp; cnt>>=1; } return ret; } }; long double op0(long double a,long double b){ return a+b; } long double e0(){ return 0; } long double op1(long double a,long double b){ return a*b; } long double e1(){ return 1; } int main(){ int N; cin>>N; matrix M(2,2); M.add_element(0,1,1.0); M.add_element(0,0,19.0/4.0); M.add_element(1,0,-3.0); if(N==0){ cout<<4.0< temp(2,1); temp.v[0][0] = 3.0; temp.v[1][0] = 4.0; temp = M.pow(N-1) * temp; cout<