#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; template struct ModInt { int x; ModInt() : x(0) {} ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if ((x += p.x) >= mod) x -= mod; return *this; } ModInt &operator-=(const ModInt &p) { if ((x += mod - p.x) >= mod) x -= mod; return *this; } ModInt &operator*=(const ModInt &p) { x = (int)(1LL * x * p.x % mod); return *this; } ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; } ModInt &operator^=(long long p) { // quick_pow here:3 ModInt res = 1; for (; p; p >>= 1) { if (p & 1) res *= *this; *this *= *this; } return *this = res; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; } ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; } ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; } ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; } ModInt operator^(long long p) const { return ModInt(*this) ^= p; } bool operator==(const ModInt &p) const { return x == p.x; } bool operator!=(const ModInt &p) const { return x != p.x; } explicit operator int() const { return x; } // added by QCFium ModInt operator=(const int p) { x = p; return ModInt(*this); } // added by QCFium ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while (b > 0) { t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } return ModInt(u); } friend std::ostream &operator<<(std::ostream &os, const ModInt &p) { return os << p.x; } friend std::istream &operator>>(std::istream &is, ModInt &a) { long long x; is >> x; a = ModInt(x); return (is); } }; template struct SegmentTree { using Monoid = typename T::Monoid; explicit SegmentTree(int n) : SegmentTree(std::vector(n, T::id())) {} explicit SegmentTree(const std::vector &a) : n(a.size()), sz(1) { while (sz < n) sz <<= 1; data.assign(sz << 1, T::id()); std::copy(a.begin(), a.end(), data.begin() + sz); for (int i = sz - 1; i > 0; --i) { data[i] = T::merge(data[i << 1], data[(i << 1) + 1]); } } void set(int idx, const Monoid val) { idx += sz; data[idx] = val; while (idx >>= 1) data[idx] = T::merge(data[idx << 1], data[(idx << 1) + 1]); } Monoid get(int left, int right) const { Monoid res_l = T::id(), res_r = T::id(); for (left += sz, right += sz; left < right; left >>= 1, right >>= 1) { if (left & 1) res_l = T::merge(res_l, data[left++]); if (right & 1) res_r = T::merge(data[--right], res_r); } return T::merge(res_l, res_r); } Monoid operator[](const int idx) const { return data[idx + sz]; } private: const int n; int sz; // sz + 原数组坐标 = 线段树里的编号,1 based std::vector data; }; namespace monoid { template struct RangeMinimumQuery { using Monoid = T; static constexpr Monoid id() { return std::numeric_limits::max(); } static Monoid merge(const Monoid &a, const Monoid &b) { return std::min(a, b); } }; template struct RangeMaximumQuery { using Monoid = T; static constexpr Monoid id() { return std::numeric_limits::lowest(); } static Monoid merge(const Monoid &a, const Monoid &b) { return std::max(a, b); } }; template struct RangeSumQuery { using Monoid = T; static constexpr Monoid id() { return 0; } static Monoid merge(const Monoid &a, const Monoid &b) { return a + b; } }; template struct RangeOrQuery { using Monoid = T; static constexpr Monoid id() { return 0; } static Monoid merge(const Monoid &a, const Monoid &b) { return a | b; } }; } // namespace monoid template struct DSU { std::vector f, siz; DSU(int n) : f(n), siz(n, 1) { std::iota(f.begin(), f.end(), 0); } T leader(T x) { while (x != f[x]) x = f[x] = f[f[x]]; return x; } bool same(T x, T y) { return leader(x) == leader(y); } bool merge(T x, T y) { x = leader(x); y = leader(y); if (x == y) return false; siz[x] += siz[y]; f[y] = x; return true; } T size(int x) { return siz[leader(x)]; } }; bool isPrime(long long number) { if (number != 2) { if (number < 2 || number % 2 == 0) { return false; } for (int i = 3; (i * i) <= number; i += 2) { if (number % i == 0) { return false; } } } return true; } std::pair, std::vector> get_prime_factor_with_kinds( int n) { std::vector prime_factors; std::vector cnt; // number of i_th factor for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { prime_factors.push_back(i); cnt.push_back(0); while (n % i == 0) n /= i, cnt[(int)prime_factors.size() - 1]++; } } if (n > 1) prime_factors.push_back(n), cnt.push_back(1); assert(prime_factors.size() == cnt.size()); return {prime_factors, cnt}; } template struct FenwickTree { std::vector bit; int n; FenwickTree(int _n) : n(_n), bit(_n) {} T sum(int r) { int ret = 0; for (; r >= 0; r = (r & (r + 1)) - 1) ret += bit[r]; return ret; } T sum(int l, int r) { assert(l <= r); return sum(r) - sum(l - 1); } // [l, r] void add(int idx, int delta) { for (; idx < n; idx = idx | (idx + 1)) bit[idx] += delta; } }; std::string solution(std::vector &a) { int n = a.size(), k = a[0].size(); std::vector> cnt(26, std::vector(k, 0)); for (int i = 0; i < k; i++) { for (int j = 0; j < n; j++) { char cur = a[j][i]; cnt[cur - 'a'][i] += 1; } } std::string ans(k, 'a'); for (int i = 0; i < k / 2; i++) { // aacd, bb std::vector mp(26, 0); for (int j = 0; j < 26; j++) { mp[j] += cnt[j][i]; mp[j] += cnt[j][k - i - 1]; } for (int y = 0; y < 26; y++) { for (int x = 0; x < mp[y]; x++) { std::cout << y << ' '; } } std::cout << '\n'; // aba, cbd -> ac int p = 0; int cur = 0; while (p < n) { p += mp[cur]; if (p >= n) { ans[i] += cur; ans[k - i - 1] += cur; break; } cur++; } } if (k & 1) { std::vector mp(26, 0); // [n / 2] for (int j = 0; j < 26; j++) { mp[j] += cnt[j][k / 2]; } int p = 0, cur = 0; while (p < n / 2) { p += mp[cur]; if (p >= n / 2) { ans[k / 2] += cur; break; } cur++; } } return ans; } void solve() { int n, l, r; std::cin >> n >> l >> r; using mint = ModInt<998244353>; mint ans = 1; for (int i = 1; i <= n; i++) ans *= i; mint k = 1; for (int i = 1; i <= n - 1; i++) k *= i; ans -= k * 2; if (l != r) { mint t = 1; for (int i = 1; i <= n - 2; i++) { t *= i; } ans += t; } std::cout << ans << '\n'; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t = 1; while (t--) solve(); return 0; }