#csp认证——“1246”
'''
n=int(input())
S=input()
endStr=""
timeOut=0
def tools(x):
result=""
global timeOut,n,endStr
for i in x:
t=str(2**int(i))
result=result+t
timeOut=timeOut+1
if(timeOut==n):
endStr=result
else:
tools(result)
tools("1")
print(endStr.count(S)%998244353) #28分
'''
#改进1
'''
n=int(input())
S=input()
makeList=[1]
def tool(x):
return str(2**int(x))
def use(x):
s = list(str(x[0]))
s = "".join(list(map(tool, s)))
makeList[0] = int(s)
for i in range(n):
use(makeList)
endStr=str(makeList[0])
print(endStr.count(S)%998244353)
# 32分
'''
算法真要好好学
调用机制,内置方法调用对比也要了解。
哎,还是得不到高分,算法还要优化啊。
没了递归,改用join而不是str的+拼接。
到头就多了4分😂