#line 1 "a.cpp" #include using namespace std; #line 3 "/home/kotatsugame/library/math/modint.cpp" #include template struct modint{ unsigned int x; constexpr modint()noexcept:x(){} template constexpr modint(T _x)noexcept:x((_x%=m)<0?_x+m:_x){} constexpr unsigned int val()const noexcept{return x;} constexpr modint&operator++()noexcept{if(++x==m)x=0;return*this;} constexpr modint&operator--()noexcept{if(x==0)x=m;--x;return*this;} constexpr modint operator++(int)noexcept{modint res=*this;++*this;return res;} constexpr modint operator--(int)noexcept{modint res=*this;--*this;return res;} constexpr modint&operator+=(const modint&a)noexcept{x+=a.x;if(x>=m)x-=m;return*this;} constexpr modint&operator-=(const modint&a)noexcept{if(x>=1)if(n&1)r*=x; return r; } constexpr modint inv()const noexcept { int s=x,t=m,x=1,u=0; while(t) { int k=s/t; s-=k*t; swap(s,t); x-=k*u; swap(x,u); } return modint(x); } friend constexpr modint operator+(const modint&a,const modint&b){return modint(a)+=b;} friend constexpr modint operator-(const modint&a,const modint&b){return modint(a)-=b;} friend constexpr modint operator*(const modint&a,const modint&b){return modint(a)*=b;} friend constexpr modint operator/(const modint&a,const modint&b){return modint(a)/=b;} friend constexpr modint operator==(const modint&a,const modint&b){return a.x==b.x;} friend constexpr modint operator!=(const modint&a,const modint&b){return a.x!=b.x;} friend ostream&operator<<(ostream&os,const modint&a){return os<>(istream&is,modint&a){long long v;is>>v;a=modint(v);return is;} }; #line 1 "/home/kotatsugame/library/math/squarematrix.cpp" #include template struct Matrix{ using arr=array; using mat=array; mat dat; Matrix():dat(){} arr&operator[](unsigned int i){return dat[i];} const arr&operator[](unsigned int i)const{return dat[i];} static Matrix eye(){ Matrix res; for(int i=0;i>=1)if(n&1)res=res*a; return res; } }; #line 5 "a.cpp" using mint=modint<(int)1e9+7>; using Mat=Matrix; main() { long N;cin>>N; Mat A; for(int i=0;i<6;i++)A[0][i]=mint(6).inv(); for(int i=0;i<5;i++)A[i+1][i]=1; A=A.pow(N); cout<