#include #include namespace nachia{ template struct StaticModint{ private: using u64 = unsigned long long; unsigned int x; public: using my_type = StaticModint; StaticModint() : x(0){} StaticModint(unsigned int v) : x(v){} unsigned int operator*() const { return x; } my_type& operator+=(const my_type& r){ auto t = x + r.x; if(t >= MOD) t -= MOD; x = t; return *this; } my_type operator+(const my_type& r) const { my_type res = *this; return res += r; } my_type& operator-=(const my_type& r){ auto t = x + MOD - r.x; if(t >= MOD) t -= MOD; x = t; return *this; } my_type operator-(const my_type& r) const { my_type res = *this; return res -= r; } my_type operator-() const { my_type res = *this; res.x = ((res.x == 0) ? 0 : (MOD - res.x)); return res; } my_type& operator*=(const my_type& r){ x = (u64)x * r.x % MOD; return *this; } my_type operator*(const my_type& r) const { my_type res = *this; return res *= r; } my_type pow(unsigned long long i) const { my_type a = *this, res = 1; while(i){ if(i & 1) res *= a; a *= a; i >>= 1; } return res; } my_type inv() const { return pow(MOD-2); } unsigned int val() const { return x; } static unsigned int get_mod() { return MOD; } my_type& operator/=(const my_type& r){ return operator*=(r.inv()); } my_type operator/(const my_type& r) const { return operator/(r.inv()); } }; } #include #include #include using namespace std; using i64 = long long; using u64 = unsigned long long; using i32 = int; using u32 = unsigned int; #define rep(i,n) for(int i=0; i<(n); i++) using m32 = nachia::StaticModint<1000000007>; int main() { int N; cin >> N; m32 dp[16]; dp[0] = 1; rep(i,N){ m32 tmp[16]; rep(d,16){ tmp[(d*2+1) % 16] += dp[d]; tmp[(d*2) % 16] += dp[d]; } tmp[10] = 0; rep(d,16) dp[d] = tmp[d]; } m32 ans = m32(2).pow(N); rep(i,16) ans -= dp[i]; cout << *ans << endl; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;