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;
struct WeightedEdge {
  int to, weight;
};
bool dfs(int start, vector<vector<WeightedEdge>> &adjList, vector<int> &color,
         int newColor) {
  color[start] = newColor;
  for (WeightedEdge e : adjList[start]) {
    if (color[e.to] == 2 &&
        !dfs(e.to, adjList, color, color[start] ^ e.weight)) {
      return false;
    } else if ((color[e.to] ^ color[start]) != e.weight) {
      return false;
    }
  }
  return true;
}
void addEdge(vector<vector<WeightedEdge>> &edges, int a, int b, int weight) {
  edges[a].push_back({b, weight});
  edges[b].push_back({a, weight});
}
int main() {
  string s;
  cin >> s;
  int m = s.length();
  vector<long long> twoPow(m + m, 1);
  for (unsigned i = 1; i < twoPow.size(); i++) {
    twoPow[i] = (twoPow[i - 1] * 2) % 998244353;
  }
  long long ans = 0L;
  for (int aLen = 1; aLen < m; aLen++) {
    vector<vector<WeightedEdge>> edges(m + aLen + 1, vector<WeightedEdge>());
    for (int i = 0; i < m / 2; i++) {
      addEdge(edges, i, m - i - 1, 0);
    }
    for (int i = 0; i < aLen / 2; i++) {
      addEdge(edges, i + m, m + aLen - i - 1, 0);
    }
    for (int i = 0; i < m - aLen; i++) {
      if (s[i] != '?') {
        addEdge(edges, i, m + aLen, s[i] - '0');
      }
    }
    for (int i = m - aLen; i < m; i++) {
      if (s[i] != '?') {
        addEdge(edges, i, i + aLen, s[i] - '0');
      }
    }
    edges[m].push_back({m + aLen, 1});
    edges[m + aLen].push_back({m, 1});
    vector<int> colors(m + aLen + 1, 2);
    int components = -1;
    for (int i = m + aLen; i >= 0; i--) {
      if (colors[i] == 2) {
        if (dfs(i, edges, colors, 0)) {
          components++;
        } else {
          goto impossible;
        }
      }
    }
    ans = (ans + twoPow[components]) % 998244353;
  impossible:;
  }
  cout << ans;
  return 0;
}