#include using namespace std; using ll = long long; template using min_priority_queue = priority_queue, greater>; using pii = pair; using pll = pair; using Graph = vector>; const ll INF = 1LL << 60; const ll Z = 998244353; template void chmax(T& a, T b) { if (b > a) a = b; } template void chmin(T& a, T b) { if (b < a) a = b; } template std::ostream& operator<<(std::ostream& os, const pair& x) noexcept { return os << "(" << x.first << ", " << x.second << ")"; } template void print_vector(vector a) { cout << '['; for (int i = 0; i < a.size(); i++) { cout << a[i]; if (i != a.size() - 1) { cout << ", "; } } cout << ']' << endl; } template class ModInt { public: constexpr ModInt() { val = 0; } constexpr ModInt(ll v) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr ll getval() const noexcept { return val; } constexpr ModInt operator-() const noexcept { if (val == 0) return 0; return MOD - val; } constexpr ModInt operator+(const ModInt& r) const noexcept { return ModInt(*this) += r; } constexpr ModInt operator-(const ModInt& r) const noexcept { return ModInt(*this) -= r; } constexpr ModInt operator*(const ModInt& r) const noexcept { return ModInt(*this) *= r; } constexpr ModInt operator/(const ModInt& r) const noexcept { return ModInt(*this) /= r; } constexpr ModInt& operator+=(const ModInt& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr ModInt& operator-=(const ModInt& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr ModInt& operator*=(const ModInt& r) noexcept { val = val * r.val % MOD; return *this; } constexpr ModInt& operator/=(const ModInt& r) noexcept { ll a = r.val, b = MOD, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator==(const ModInt& r) const noexcept { return this->val == r.val; } constexpr bool operator!=(const ModInt& r) const noexcept { return this->val != r.val; } friend constexpr std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; } // n乗 を MOD で割った余り constexpr ModInt pow(ll n) noexcept { if (n == 0) return 1; auto t = this->pow(n / 2); t = t * t; if (n & 1) t = t * val; return t; } // 逆元 constexpr ModInt inv() noexcept { ModInt one = 1; return one / *this; } ModInt& operator=(ll v) noexcept { val = v % MOD; return *this; } ModInt& operator=(const ModInt& v) noexcept { val = v.val % MOD; return *this; } private: ll val; }; using mint = ModInt; void solve() { ll N, A, B; cin >> N >> A >> B; if (A == B) { mint ret = 1; for (int i = 1; i <= N - 2; i++) { ret = ret * i; } ret *= (N - 2); ret *= (N - 1); std::cout << ret << "\n"; return; } // 最初の要素にBを選ぶ mint tmp1 = 1; for (int i = 1; i <= N - 2; i++) { tmp1 = tmp1 * i; } tmp1 *= (N - 1); tmp1 *= 1; // 最初の要素にAでもBでもないものを選ぶ mint tmp2 = 1; for (int i = 1; i <= N - 2; i++) { tmp2 = tmp2 * i; } tmp2 *= (N - 2); tmp2 *= (N - 2); std::cout << tmp1 + tmp2 << "\n"; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); int T = 1; while (T--) { solve(); } return 0; }