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>
const int MAX_N = 1000;
const int MAX_V = 2 * MAX_N;
const int MOD = 998244353;
struct Edge {
  int v;
  int w;
};
std::vector<Edge> neighbours[MAX_V];
bool visited[MAX_V];
bool value[MAX_V];
void addEdge(int a, int b, int w) {
  neighbours[a].push_back(Edge{b, w});
  neighbours[b].push_back(Edge{a, w});
}
void addSelf(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
int main() {
  std::string s;
  std::cin >> s;
  std::reverse(s.begin(), s.end());
  int n = s.length();
  int answer = 0;
  for (int lenA = 1; lenA < n; lenA++) {
    for (int i = 0; i < MAX_V; i++) neighbours[i].clear();
    for (int i = 0; i < lenA - i; i++) addEdge(i, lenA - 1 - i, 0);
    for (int i = 0; i < n - i; i++) addEdge(n + i, n + n - 1 - i, 0);
    for (int i = 0; i < n; i++)
      if (s[i] != '?') addEdge(i, n + i, s[i] - '0');
    std::queue<int> bfsQ;
    for (int u = 0; u < MAX_V; u++) visited[u] = false;
    for (int u = lenA; u < n; u++) {
      visited[u] = true;
      value[u] = 0;
      bfsQ.push(u);
    }
    visited[2 * n - 1] = true;
    value[2 * n - 1] = 1;
    bfsQ.push(2 * n - 1);
    visited[lenA - 1] = true;
    value[lenA - 1] = 1;
    bfsQ.push(lenA - 1);
    int answerLenA = 1;
    while (!bfsQ.empty()) {
      int u = bfsQ.front();
      bfsQ.pop();
      for (Edge e : neighbours[u]) {
        if (!visited[e.v]) {
          visited[e.v] = true;
          value[e.v] = value[u] ^ e.w;
          bfsQ.push(e.v);
        } else {
          if (value[e.v] != (value[u] ^ e.w)) {
            answerLenA = 0;
          }
        }
      }
    }
    for (int i = 0; i < 2 * n; i++) {
      if (!visited[i]) {
        addSelf(answerLenA, answerLenA);
        visited[i] = true;
        value[i] = 0;
        bfsQ.push(i);
        while (!bfsQ.empty()) {
          int u = bfsQ.front();
          bfsQ.pop();
          for (Edge e : neighbours[u]) {
            if (!visited[e.v]) {
              visited[e.v] = true;
              value[e.v] = value[u] ^ e.w;
              bfsQ.push(e.v);
            } else {
              if (value[e.v] != (value[u] ^ e.w)) {
                answerLenA = 0;
              }
            }
          }
        }
      }
    }
    addSelf(answer, answerLenA);
  }
  printf("%d\n", answer);
  return 0;
}