#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #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 rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(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()) #define Endl endl using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; template using vv=vector>; template ostream& operator<<(ostream &os, const vector &t) { os<<"{"; rep(i,t.size()) {os< ostream& operator<<(ostream &os, const pair &t) { return os<<"("< inline bool MX(T &l,const T &r){return l inline bool MN(T &l,const T &r){return l>r?l=r,1:0;} #define out(args...){vector a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); } vector s_p_l_i_t(const string &s, char c){vector v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);} void e_r_r(vector::iterator it) {} template void e_r_r(vector::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr< substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);} const ll MOD=1e9+7; inline double Mod(double v,double mod=MOD){ return v; } inline ll Mod(ll v,ll mod=MOD){ return v%mod; } typedef vector > matl; typedef vector > matd; template vector operator*(const T &a,vector v){ rep(i,v.size()) v[i]=Mod(v[i]*a); return v; } template vector operator+(vector v,const vector &w){ rep(i,v.size()) v[i]=Mod(v[i]+w[i]); return v; } template vector > matE(T n){ vector > re(n,vector(n)); rep(i,n) re[i][i]=1; return re; } templatevector >matE(vector >mat){ return matE((T)(mat.size())); } template vector > transpose(const vector > &a, vector> &re){ re.resize(a[0].size(),vector(a.size())); rep(i,a[0].size()) rep(j,a.size()) re[i][j]=a[j][i]; return re; } template T operator*(const vector &a, const vector &b){ T re=0; rep(i,a.size()) re=Mod(re+Mod(a[i]*b[i])); return re; } template vector > operator*(const vector > &a ,const vector > &b_){ vector > b; transpose(b_,b); vector > re(a.size(),vector(b.size())); rep(i,a.size()) rep(j,b.size()) re[i][j]=a[i]*b[j]; return re; } template vector > pow(vector > a,ll n){ vector > re; if(n==0) return matE(a); re=pow(a,n/2); return re*re*(n%2?a:matE(a)); } int main(){ ios_base::sync_with_stdio(false); cout<(10)); reps(i,0,10) A[i][i]=1; reps(i,1,9)if(i!=5) A[9][i]=1; reps(i,1,8) A[i][0]=1; A[8][7]=1; reps(i,1,8)rep(j,8)if(i&j && !(i==5) && j!=5) A[i][j]=1; A[7][5]=A[5][5]=1; A[1][8]=A[4][8]=1; A[5][1]=A[5][4]=1; int n; cin>>n; matl B=pow(A,n+1); //out(A,B,1); cout<