#define mod 998244353
template <typename T>
inline void read(T & x) {
T f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') {
f = -1;
}
c = getchar();
}
x = 0;
while (c >= '0' && c <= '9') {
x = (x << 3) + (x << 1) + c - '0';
c = getchar();
}
x *= f;
}
template <typename T, typename ... Args>
inline void read(T & tmp, Args & ... tmps) {
read(tmp);
read(tmps ...);
}
template <typename T>
inline void write(T x) {
T s[20], top = 0;
if (x < 0) {
putchar('-');
x = ~(x - 1);
}
while (x) {
s[++top] = x % 10;
x /= 10;
}
if (!top) {
s[++top] = 0;
}
while (top) {
putchar(s[top--] + '0');
}
}
template <typename T>
inline T quick_pow(T a, T b, T ans = 1) {
while (b) {
if (b & 1) {
ans = ans * a % mod;
}
a = a * a % mod;
b >>= 1;
}
return ans;
}