Problem: You are given a string s consisting of characters "1", "0", and "?". The first character of s is guaranteed to be "1". Let m be the number of characters in s.

Count the number of ways we can choose a pair of integers a, b that satisfies the following: 

  * 1 ≤ a < b < 2^m 
  * When written without leading zeros, the base-2 representations of a and b are both palindromes. 
  * The base-2 representation of bitwise XOR of a and b matches the pattern s. We say that t matches s if the lengths of t and s are the same and for every i, the i-th character of t is equal to the i-th character of s, or the i-th character of s is "?". 



Compute this count modulo 998244353. 

Input

The first line contains a single string s (1 ≤ |s| ≤ 1 000). s consists only of characters "1", "0" and "?". It is guaranteed that the first character of s is a "1".

Output

Print a single integer, the count of pairs that satisfy the conditions modulo 998244353.

Examples

Input


10110


Output


3


Input


1?0???10


Output


44


Input


1?????????????????????????????????????


Output


519569202


Input


1


Output


0

Note

For the first example, the pairs in base-2 are (111, 10001), (11, 10101), (1001, 11111).

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > Adj;
vector<int> Col;
bool DFS(int u, int f) {
  Col[u] = 1 + f;
  bool pos = 0;
  for (auto i : Adj[u]) {
    if (Col[i.first]) {
      if ((f ^ i.second) == Col[i.first] - 1)
        continue;
      else
        return 1;
    }
    pos |= DFS(i.first, f ^ i.second);
  }
  return pos;
}
template <typename T>
T fast_exp(T base, T power, T M = 0) {
  if (M) base %= M;
  T result = 1;
  while (power) {
    if (power & 1) result *= base;
    power >>= 1;
    base *= base;
    if (M) {
      base %= M;
      result %= M;
    }
  }
  return result;
}
long long Calc(string S, int lA, int lB) {
  Adj.clear();
  Col.clear();
  Adj.resize(lA + lB + 1);
  Col.resize(lA + lB + 1);
  for (int x = 0; x < lA; x++) {
    Adj[x].push_back({lA - x - 1, 0});
    Adj[lA - x - 1].push_back({x, 0});
  }
  for (int x = 0; x < lB; x++) {
    Adj[lA + x].push_back({lA + lB - x - 1, 0});
    Adj[lA + x].push_back({lA + lB - x - 1, 0});
  }
  for (int x = 0; x < lA; x++) {
    if (S[x] == '?') continue;
    if (x < lA - lB) {
      Adj[x].push_back({lA + lB, S[x] - '0'});
      Adj[lA + lB].push_back({x, S[x] - '0'});
    } else {
      Adj[x].push_back({lB + x, S[x] - '0'});
      Adj[lB + x].push_back({x, S[x] - '0'});
    }
  }
  Adj[lA + lB].push_back({lA, 1});
  Adj[lA].push_back({lA + lB, 1});
  int cnt = 0;
  for (int x = 0; x < lA + lB + 1; x++) {
    if (Col[x]) continue;
    if (DFS(x, 0)) return 0;
    cnt++;
  }
  return fast_exp<long long>(2, cnt - 1, 998244353);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  long long ans = 0;
  int lA = S.size();
  for (int lB = 1; lB < lA; lB++) {
    ans += Calc(S, lA, lB);
    ans %= 998244353;
  }
  cout << ans << endl;
  return 0;
}