#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max() / 32 * 15 + 208; template struct REC { F f; REC(F &&f_) : f(std::forward(f_)) {} template auto operator()(Args &&... args) const { return f(*this, std::forward(args)...); } }; int main() { ll n; cin >> n; int a[] = {1, 12, 65, 172}; if(n < 4) cout << a[n] << "\n"; else cout << (17*n*n+6*n+1)%MOD << "\n"; return 0; }