Your task is to calculate the number of arrays such that:
each array contains n elements;
each element is an integer from 1 to m;
for each array, there is exactly one pair of equal elements;
for each array a, there exists an index i such that the array is strictly ascending before the i-th element and strictly descending after it (formally, it means that aj<aj+1, if j<i, and aj>aj+1, if j≥i).
Input
The first line contains two integers n and m (2≤n≤m≤2⋅105).
Output
Print one integer — the number of arrays that meet all of the aforementioned conditions, taken modulo 998244353.
Examples
input
3 4
output
6
input
3 5
output
10
input
42 1337
output
806066790
input
100000 200000
output
707899035
Note
The arrays in the first example are:
[1,2,1];
[1,3,1];
[1,4,1];
[2,3,2];
[2,4,2];
[3,4,3].
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 998244353;
inline ll qp(ll a, ll x) {
ll ans = 1;
a %= mod;
for (; x; x >>= 1) {
if (x & 1) ans = ans * a % mod;
a = a * a % mod;
}
return ans;
}
ll c(ll n, ll m) {
if (n < m)swap(n, m);
ll ans = 1;
for (int i = 1; i <= m; i++) {
ll a = (n + i - m) % mod;
ll b = i % mod;
ans = ans * (a * qp(b, mod - 2) % mod) % mod;
}
return ans;
}
ll lucas(ll n, ll m) {
if (m == 0) return 1;
return c(n % mod, m % mod) * lucas(n / mod, m / mod) % mod;
}
int main() {
ll n, m;
scanf("%lld%lld", &n, &m);
if (n == 2) {
puts("0");
return 0;
}
ll ans = 1;
for (int i = 1; i <= n - 3; i++) ans = ans * 2 % mod;
ans = (ans * (n - 2)) % mod;
ans = ans * lucas(m, n - 1) % mod;
printf("%lld\n", (ans + mod) % mod);
return 0;
}