#include using ll = long long; // #define int ll #define FOR(i, a, b) for (int i = (a); i < int(b); ++i) #define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i) #define rep(i, n) FOR(i, 0, n) #define rep1(i, n) FOR(i, 1, int(n) + 1) #define rrep(i, n) RFOR(i, 0, n) #define rrep1(i, n) RFOR(i, 1, int(n) + 1) #define all(c) begin(c), end(c) const int MOD = 1000000007; template void __print__(std::ostream &os, const char *, const char *tail, const T &fst) { os << fst << tail; } template void __print__(std::ostream &os, const char *del, const char *tail, const Fst &fst, const Rst &... rst) { os << fst << del; __print__(os, del, tail, rst...); } #ifdef LOCAL #define dump(...) \ do { \ std::ostringstream os; \ os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \ __print__(os, ", ", "\n", __VA_ARGS__); \ std::cerr << os.str(); \ } while (0) #else #define dump(...) #endif template void println(const Fst &fst, const Rst &... rst) { __print__(std::cout, "\n", "\n", fst, rst...); } template void print(const Fst &fst, const Rst &... rst) { __print__(std::cout, " ", "\n", fst, rst...); } template void println_(iter bgn, iter end) { while (bgn != end) println(*bgn++); } template void print_(iter bgn, iter end) { while (bgn != end) { std::cout << *bgn++; std::cout << (bgn == end ? "\n" : " "); } } int _ = (std::cout.precision(10), std::cout.setf(std::ios::fixed), std::cin.tie(0), std::ios::sync_with_stdio(0), 0); template std::vector ndarray(int n, T v) { return std::vector(n, v); } template auto ndarray(int n, Args... args) { auto val = ndarray(args...); return std::vector(n, move(val)); } template bool umax(T &a, const T &b) { return a < b ? a = b, true : false; } template bool umin(T &a, const T &b) { return a > b ? a = b, true : false; } using namespace std; template struct segment_tree { using M = monoid; using T = typename M::value_type; std::size_t sz; std::vector x; segment_tree(std::size_t n = 0) { sz = 1; while (sz < n) sz *= 2; x.assign(sz * 2, M::id()); initialize(); } template segment_tree(iterator first, iterator last) { sz = 1; std::size_t n = std::distance(first, last); while (sz < n) sz *= 2; x.assign(sz * 2, M::id()); std::copy(first, last, x.begin() + sz); initialize(); } void fill(const T& val) { std::fill(x.begin() + sz, x.end(), val); initialize(); } void initialize() { for (int i = (int)sz - 1; i >= 1; --i) { x[i] = M::op(x[i * 2 + 0], x[i * 2 + 1]); } } T accumulate(std::size_t l, std::size_t r) const { T al = M::id(), ar = M::id(); for (l += sz, r += sz; l < r; l /= 2, r /= 2) { if (l & 1) al = M::op(al, x[l++]); if (r & 1) ar = M::op(x[--r], ar); } return M::op(al, ar); } void update(std::size_t i, const T &val) { x[i += sz] = val; while (i > 1) { x[i / 2] = M::op(x[i], x[i ^ 1]); i /= 2; } } T operator[](std::size_t i) const { return x[sz + i]; } }; template struct min_monoid { using value_type = T; static constexpr T id() { return std::numeric_limits::max(); } static T op(const T &a, const T &b) { return std::min(a, b); } }; template struct max_monoid { using value_type = T; static constexpr value_type id() { return std::numeric_limits::min(); } static value_type op(const value_type &a, const value_type &b) { return std::max(a, b); } }; template struct sum_monoid { using value_type = T; static constexpr value_type id() { return 0; } static value_type op(const value_type &a, const value_type &b) { return (a + b) % MOD; } }; template using rmq = segment_tree>; template using rsq = segment_tree>; int main() { int n; while (cin >> n) { rsq e(n + 1), o(n + 1); vector a(n + 1); a[1] = 1; o.update(1, 1); FOR(i, 2, n + 1) { a[i] = i * (i%2 == 0 ? o.accumulate(0, n) : e.accumulate(0, n)) % MOD; if (i % 2 == 0) e.update(i, a[i]); else o.update(i, a[i]); dump(i, a[i]); } print(a[n]); } }