#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000000 #define Inf64 1000000000000000001LL int main(){ string s; cin>>s; long long cur = 0; reverse(s.begin(),s.end()); vector t(s.size()); rep(i,s.size()){ if(s[i]=='1'){ t[i] = mint(2) / mint(3); cur += pow_mod(2,i,998244352); } else{ mint tt = mint(2) / mint(3); t[i] = tt.pow(cur+2); } cur %= 998244352; } mint All = mint(3).pow(cur); mint ans = 0; rep(i,s.size()){ mint tt = mint(2).pow(i); tt *= All; tt *= t[i]; ans += tt; } cout<