#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair P; const ll MOD=1e9+7; vector> matrixmul(int l, int m, int n, vector> a, vector> b){ vector> c(l, vector(n)); for(int i=0; i> matrixpow(int n, vector> a, ll k){ vector> ap=a, ans(n, vector(n)); for(int i=0; i>=1; } return ans; } ll a[]={32,316,2292,14422,84744,479004,2638328,14258574,75940592,399782668,84795558,786749020}; ll c[]={4,4,999999968,56,62,999999621,753,999999123,685,999999665,102,999999991}; int main() { ll n; cin>>n; vector> mat(12, vector(12)); for(int i=0; i<11; i++) mat[i][i+1]=1; for(int i=0; i<12; i++) mat[11][i]=MOD-c[i]; auto matp=matrixpow(12, mat, n-1); ll ans=0; for(int i=0; i<12; i++) (ans+=matp[0][i]*a[i])%=MOD; cout<