import sys input = sys.stdin.readline S=input().strip() mod=998244353 A=0 z=0 zo=0 q=1 for s in S: if s=="0": z+=1*q A+=zo elif s=="1": zo+=z else: A=A+A+zo zo=zo+zo+z z=z+z+1*q q*=2 A%=mod z%=mod zo%=mod print(A)