#include #include #include using namespace std; using mint = atcoder::modint1000000007; const vector ans{1, 12, 65}; void solve() { int n; cin >> n; if (n <= 2) { cout << ans[n] << "\n"; } else { n -= 2; cout << (mint(n) * n * 17 + mint(n) * 74 + 81).val() << "\n"; } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }