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>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/STACK:2000000")
using namespace std;
template <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 4e5 + 5, LG = 19, MOD = 998244353;
const int SQ = 320;
const long double EPS = 1e-7;
vector<vector<ii>> adj, baseAdj;
int n;
string s;
int col[2005];
void addEdge(int u, int v, int c) {
  adj[u].push_back(ii(v, c));
  adj[v].push_back(ii(u, c));
}
bool dfs(int node, int c) {
  if (~col[node]) return col[node] == c;
  col[node] = c;
  bool ok = true;
  for (auto v : adj[node]) ok &= dfs(v.first, c ^ v.second);
  return ok;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  n = s.size();
  adj.resize(n + n);
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') addEdge(i, n + i, 1);
    if (s[i] == '0') addEdge(i, n + i, 0);
    addEdge(i, n - 1 - i, 0);
  }
  baseAdj = adj;
  int ans = 0;
  for (int len = 1; len < n; len++) {
    adj = baseAdj;
    memset(col, -1, sizeof col);
    for (int j = 0; j < len; j++) {
      int l = n - 1 - j;
      int r = (n - 1 - (len - 1 - j));
      addEdge(n + l, n + r, 0);
    }
    int lft = n - len;
    bool f = true;
    for (int j = 0; j < lft; j++)
      if (~col[n + j]) {
        f &= (col[n + j] == 0);
      } else
        f &= dfs(n + j, 0);
    if (~col[n + lft]) {
      f &= (col[n + lft] == 1);
    } else
      f &= dfs(n + lft, 1);
    int cur = 1;
    for (int i = n + lft + 1; i < n + n; i++)
      if (col[i] == -1) {
        cur += cur;
        if (cur >= MOD) cur -= MOD;
        f &= dfs(i, 0);
      }
    for (int i = 0; i < n; i++)
      if (col[i] == -1) {
        cur += cur;
        if (cur >= MOD) cur -= MOD;
        f &= dfs(i, 0);
      }
    if (f) {
      ans += cur;
      if (ans >= MOD) ans -= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}