/** * date : 2023-04-06 22:55:51 */ #define NDEBUG #include #include using namespace std; #include #include using namespace std; namespace Base64 { using L = long long; char base[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int ibase(char c) { return 'a' <= c ? 0x1A + c - 'a' : 'A' <= c ? 0x00 + c - 'A' : '0' <= c ? 0x34 + c - '0' : '+' == c ? 0x3E : 0x3F; } template string encode(vector &a) { T x = a[0], y = a[0]; for (auto &z : a) x = max(x, z), y = min(y, z); L N = a.size(), B = max(6, y < 0 ? sizeof(T) * 8 : 64 - __builtin_clzll(x)); string S((B * N + 11) / 6, 0); S[0] = B; for (int i = 0; i < N; i++) { for (int j = 0; j < B; j++) { if ((a[i] >> j) & 1) S[(i * B + j) / 6 + 1] |= 1 << ((i * B + j) % 6); } } for (auto &c : S) c = base[(int)c]; return S; } vector decode(string S) { for (auto &c : S) { c = ibase(c); } L B = S[0], M = S.size() - 1; vector a(6 * M / B, 0); for (int i = 0; i < M; i++) { for (int j = 0; j < 6; j++) { if ((S[i + 1] >> j) & 1) a[(i * 6 + j) / B] |= 1LL << ((i * 6 + j) % B); } } return a; } } // namespace Base64 string S = "eBAAAAhInNmXjQdil4PWA2OUcP4bxD6NXS2SgYmIpHM5+O39Wb6xthroQFjBIZB+tF6Gfn3ZpU+JiWTsjFF+BUsq40O0f5VlkZ2NR8xZRd+75nO/APuh3J2tOnksDAOBw8imMBEmiDmj0J1GKBEnZsyM3vjEz/z+Pkx/MyAd800iVd7cf/bpbRBfbgXKUi1gb0nvMwV8EA/IJrahHVJOmMCri860RnCdSTLMSTKu16wXuhRnflzwjRmAbgwNW6AErtupdhvYtLl7aCrQpCnNX+UTYhNoctV9zfsf+QYwOQyauztZoBWVQIaM72iDNqyWACszqtE67IkN5YKFLTIC1DrlUUQeQIWszQSl+YVBvqT2LwWtEb7DPg4iMoXGAh4GkVdN6pcsySejE0x5xMAh6LACnZf2KWjilBrqIvfqXbuK72fK6bNaxZ3Fym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h5isNqS9t3C7jRZ4lgkrUQ9LxQ34vlb0RL4B+9YDLUaLk5r0rK7FEYn2Iuli0XeBp1lF9LT95ijeLVJFSSGlNH9f5p5hQqXdHUuEJuP72J88eioXCPq23OGwf4OFNsD2xld1w4/fuQM1HBWZfW2Y+8Rr3UQza0rUohvmQWGnghyczYFxP7qWi08BXEAR464YNJhyjlcYOAqyimayJ4MpHpRMrpbMAEQ1iuzyWBxs+HqjDMD1zsW/opAAAAA"; int main() { /* int M = 1002, Z = 1000000; vector v(M); v[0] = 1; for (long long i = 1, x = 1; i < M * Z; i++) { x = x * i % 1000000007; if (i % Z == 0) v[i / Z] = x; } cout << Base64::encode(v) << "\n"; */ auto a = Base64::decode(S); long long N, Z = 1000000; cin >> N; long long x = a[N / Z]; for (long long b = N / Z * Z + 1; b <= N; b++) { x = x * b % 1000000007; } cout << x << "\n"; }