import math class MathCount: def __init__(self): self.fac = [1] self.fac_ = [1] def factorial(self, x, y=True): if y: while x >= len(self.fac): self.fac.append(self.fac[-1]*len(self.fac) % MOD) return self.fac[x] else: while x >= len(self.fac_): self.fac_.append( self.fac_[-1]*pow(len(self.fac_), MOD-2, MOD) % MOD) return self.fac_[x] def nCr(self, n, r): return self.factorial(n, True)*self.factorial(r, False)*self.factorial(n-r, False) % MOD def nPr(self, n, r): return self.factorial(n, True)*self.factorial(n-r, False) % MOD def nHr(self, n, r): return self.nCr(n+r-1, r) MOD = 998244353 N, M = map(int, input().split()) mc = MathCount() ans = 0 for x in range(N+1): if x**2 < M: continue y = math.isqrt(x**2-M) if x**2-y**2 != M: continue if (x+y+N) % 2 == 1: continue k = (N-x-y)//2 for i in range(k+1): tmp = 1 tmp *= mc.nCr(N, x+i) tmp%=MOD tmp *= mc.nCr(N-x-i, i) tmp%=MOD tmp *= mc.nCr(N-x-2*i, y+k-i) tmp%=MOD ans+=tmp ans*=pow(4,-N+1,MOD) ans%=MOD print(ans)