#include using namespace std; using ll = long long; #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 __dump__(std::ostream &os, const T &first) { os << first; } template void __dump__(std::ostream &os, const First &first, const Rest &... rest) { os << first << ", "; __dump__(os, rest...); } #define dump(...) \ do { \ std::ostringstream os; \ os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \ __dump__(os, __VA_ARGS__); \ std::cerr << os.str() << std::endl; \ } while (0) int main() { ll n; cin >> n; int sign = n / MOD % 2 == 0 ? 1 : -1; unsigned long long res = sign < 0 ? MOD - 1 : 1; n %= MOD - 1; for (unsigned i = 1; i <= n; ++i) { res *= i; if (res > (1ull << 63) / 100) { res %= MOD; } } res %= MOD; cout << res << endl; }