#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> s; int n = s.size(); vector> dp(n+1,vector(4,0)); dp[0][0] = 1; rep(i,n){ if(s[i]!='1'){ rep(j,4) dp[i+1][j] += dp[i][j]; dp[i+1][1] += dp[i][0]; dp[i+1][3] += dp[i][2]; } if(s[i]!='0'){ rep(j,4) dp[i+1][j] += dp[i][j]; dp[i+1][2] += dp[i][1]; } } cout << dp[n][3] << '\n'; return 0; }