#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n+1); i++)
#define repn(i,a,b) for (int i = (int)(a) ; i < (int)(b+1); i++)
#define repv(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define uni(v) v.erase(unique(v.begin(), v.end()), v.end());
using ll = long long;
using P = pair<int,int>;
using mint = modint998244353;
ostream& operator<< (ostream& os, const mint &x) {os << x.val(); return os;}
#ifdef LOCAL
    #include <debug.hpp>
    #define debug(...) debug::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
    #define debug(...) (static_cast<void>(0))
#endif

int main(){
    string s;
    cin >> s;
    mint zero_num = 0, zero_one_num = 0, ans = 0, now = 1;
    for(auto c : s){
        if(c == '0'){
            zero_num+= now;
            ans += zero_one_num;
        }else if(c == '1'){
            zero_one_num += zero_num;
        }else{
            ans *= 2;
            ans += zero_one_num;
            zero_one_num *= 2;
            zero_one_num += zero_num;
            zero_num *= 2;
            zero_num+= now;
            now *= 2;
        }
        debug(zero_num, zero_one_num, ans);
    }
    cout << ans << endl;
    return 0;
}