from itertools import accumulate MOD = 998244353 S = input() INV2 = pow(2, MOD - 2, MOD) a = [] c = 0 for i in range(len(S)): if S[i] == '0': a.append(1) elif S[i] == '?': a.append(INV2) c += 1 else: a.append(0) acl = [0] now = 0 for i in a: now += i now %= MOD acl.append(now) a.reverse() acr = [0] now = 0 for i in a: now += i now %= MOD acr.append(now) acr.reverse() a.reverse() ans = 0 for i in range(len(a)): ans += (1 - a[i]) * acl[i] * acr[i + 1] ans %= MOD print((ans * pow(2, c, MOD)) % MOD)