#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using mat = vector<vector<LL>>;
const LL mod=1e9+7;

mat matmul(mat &A, mat &B){
	mat C(A.size(),vector<LL>(B[0].size()));
	rep(i,A.size()){
		rep(k,B.size()){
			rep(j, B[0].size()){
				(C[i][j]+=A[i][k]*B[k][j])%=mod;
			}
		}
	}
	return C;
}

mat matpow(mat A, LL n){
	mat C(A.size(),vector<LL>(A.size()));
	rep(i,A.size()) C[i][i]=1;
	while(n>0){
		if(n&1) C=matmul(C,A);
		A=matmul(A,A);
		n>>=1;
	}
	return C;
}

LL modinv(LL x){
	LL m=mod, u=1, v=0;
	while(m){
		LL t=x/m;
		x-=t*m; swap(x,m);
		u-=t*v; swap(u,v);
	}
	u%=mod;
	if(u<0) u+=mod;
	return u;
}

int main(){
	LL N;
	cin >> N;
	mat A(6,vector<LL>(6));
	rep(i,6) A[5][i]=modinv(6);
	rep(i,5){
		rep(j,6){
			if(i+1==j) A[i][j]=1;
			else A[i][j]=0;
		}
	}
	mat B=matpow(A,N);
	cout << B[5][5] << endl;

	return 0;
}