n,k = map(int,input().split()) MOD = 998244353 dpn = [[0]*k for _ in range(k)] dps = [[0]*k for _ in range(k)] for i in range(k): for j in range(i+1,k): dpn[i][j] = dpn[j][i] = 1 dps[i][j] = dps[j][i] = i+j for I in range(n-2): ndpn = [[0]*(k+1) for _ in range(k)] ndps = [[0]*(k+1) for _ in range(k)] for i in range(k): for j in range(i+1,k): ndpn[j][0] += dpn[i][j] ndpn[j][0] %= MOD ndpn[j][i] -= dpn[i][j] ndpn[j][i] %= MOD ndpn[j][i+1] += dpn[i][j] ndpn[j][i+1] %= MOD ndpn[j][j] -= dpn[i][j] ndpn[j][j] %= MOD for j in range(i): ndpn[j][j+1] += dpn[i][j] ndpn[j][j+1] %= MOD ndpn[j][i] -= dpn[i][j] ndpn[j][i] %= MOD ndpn[j][i+1] += dpn[i][j] ndpn[j][i+1] %= MOD ndpn[j][k] -= dpn[i][j] ndpn[j][k] %= MOD dpn = ndpn for i in range(k): for j in range(1,k+1): dpn[i][j] += dpn[i][j-1] dpn[i][j] %= MOD v = sum(sum(i) for i in dpn)%MOD w = v*(k-1)*n//2%MOD print(v,w)