#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long dp[202][202][202] = {}, dp1[202][202][202] = {}; long long mod = 998244353; int main() { long long n, m; cin >> n >> m; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { if (i != j) { dp[2][i][j] = 1; dp1[2][i][j] = i + j; } } } for (int i = 1; i < m; i++) { for (int j = 0; j < m; j++) { dp[2][i][j] += dp[2][i - 1][j]; dp1[2][i][j] += dp1[2][i - 1][j]; dp[2][i][j] %= mod; dp1[2][i][j] %= mod; } } for (int i = 3; i <= n; i++) { for (int j = 0; j < m; j++) { for (int k = 0; k < m; k++) { if (j == k) { dp[i][j][k] = 0; dp1[i][j][k] = 0; } if (j > k) { dp[i][j][k] += dp[i - 1][j - 1][j]; dp[i][j][k] -= dp[i - 1][k][j]; if (k != 0) { dp[i][j][k] += dp[i - 1][k - 1][j]; } dp1[i][j][k] += dp1[i - 1][j - 1][j]; dp1[i][j][k] += dp[i - 1][j - 1][j] * k; dp1[i][j][k] -= dp1[i - 1][k][j]; dp1[i][j][k] -= dp[i - 1][k][j] * k; if (k != 0) { dp1[i][j][k] += dp1[i - 1][k - 1][j]; dp1[i][j][k] += dp[i - 1][k - 1][j] * k; } } if (j < k) { dp[i][j][k] += dp[i - 1][m - 1][j]; dp[i][j][k] -= dp[i - 1][j][j]; dp[i][j][k] -= dp[i - 1][k][j]; if (k != 0) { dp[i][j][k] += dp[i - 1][k - 1][j]; } dp1[i][j][k] += dp1[i - 1][m - 1][j]; dp1[i][j][k] += dp[i - 1][m - 1][j] * k; dp1[i][j][k] -= dp1[i - 1][j][j]; dp1[i][j][k] -= dp[i - 1][j][j] * k; dp1[i][j][k] -= dp1[i - 1][k][j]; dp1[i][j][k] -= dp[i - 1][k][j] * k; if (k != 0) { dp1[i][j][k] += dp1[i - 1][k - 1][j]; dp1[i][j][k] += dp[i - 1][k - 1][j] * k; } } dp[i][j][k] %= mod; dp1[i][j][k] %= mod; } } for (int j = 1; j < m; j++) { for (int k = 0; k < m; k++) { dp[i][j][k] += dp[i][j - 1][k]; dp1[i][j][k] += dp1[i][j - 1][k]; dp[i][j][k] %= mod; dp1[i][j][k] %= mod; } } } long long ans1 = 0, ans2 = 0; for (int i = 0; i < m; i++) { ans1 += dp[n][m - 1][i]; ans2 += dp1[n][m - 1][i]; ans1 %= mod, ans2 %= mod; } cout << ans1 << " " << ans2 << endl; }