import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n,m = map(int,input().split())
s = set()
for i in range(n+1):
    s.add(i**2)
xy = []
for i in range(n+1):
    xx = i*i
    yy = xx-m
    if yy in s:
        xy.append([i, int(pow(yy,0.5))])
mod = 998244353

# nCk
def com(n, mod):
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    for i in range(2, n+1):
        fact.append((fact[-1]*i) % mod)
        inv.append((-inv[mod % i]*(mod//i)) % mod)
        factinv.append((factinv[-1]*inv[-1]) % mod)
    return fact, factinv
f,fi = com(n+10, mod)

ans = 0
for x,y in xy:
    for dx in range(n+1):
        dy = n-dx
        if dx < x or dy < y: continue
        if dx%2 != x%2 or dy%2 != y%2: continue
        a = x + (dx-x)//2
        b = (dx-x)//2
        c = y + (dy-y)//2
        d = (dy-y)//2

        tmp = f[n] * fi[a]%mod * fi[b]%mod * fi[c]%mod * fi[d] %mod
        if x != 0:
            tmp *= 2
            tmp %= mod
        if y != 0:
            tmp *= 2
            tmp %= mod
        ans += tmp
        ans %= mod
print(ans * pow(pow(4, n, mod), mod-2, mod) % mod)