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;
const int N = 1e3 + 7, mod = 998244353;
int n;
string str;
vector<int> graph[2][2 * N], subgraph[2 * N];
int dsu[2 * N], sz[2 * N], col[2 * N];
long long res;
int get(int v) {
  if (dsu[v] == v) {
    return v;
  }
  return dsu[v] = get(dsu[v]);
}
void merge(int a, int b) {
  a = get(a);
  b = get(b);
  if (a == b) {
    return;
  }
  if (sz[a] < sz[b]) {
    swap(a, b);
  }
  dsu[b] = a;
  sz[a] += sz[b] == sz[b];
}
bool dfs(int v) {
  for (auto i : subgraph[v]) {
    if (col[i] == col[v]) {
      return 1;
    }
    if (col[i] != -1) {
      continue;
    }
    col[i] = !col[v];
    if (dfs(i)) {
      return 1;
    }
  }
  return 0;
}
int binPow(int a, int b) {
  int res = 1;
  while (b) {
    if (b % 2) {
      res = (1ll * res * a) % mod;
    }
    a = (1ll * a * a) % mod;
    b >>= 1;
  }
  return res;
}
void edge(int a, int b, vector<int> *g) {
  g[a].push_back(b);
  g[b].push_back(a);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> str;
  n = str.size();
  reverse(str.begin(), str.end());
  for (int len = 1; len <= n; ++len) {
    for (int i = 0; i < 2 * N; ++i) {
      for (int j = 0; j < 2; ++j) {
        graph[j][i].clear();
      }
      subgraph[i].clear();
      dsu[i] = i;
      col[i] = -1;
    }
    for (int i = 0; i < n / 2; ++i) {
      edge(i, n - 1 - i, graph[0]);
    }
    for (int i = 0; i < len / 2; ++i) {
      edge(n + i, n + len - 1 - i, graph[0]);
    }
    for (int i = 0; i < len; ++i) {
      if (str[i] == '?') continue;
      edge(i, n + i, graph[str[i] - '0']);
    }
    for (int i = len; i < n; ++i) {
      if (str[i] == '?') continue;
      edge(i, n + len, graph[str[i] - '0']);
    }
    edge(n - 1, n + len, graph[1]);
    edge(n + len - 1, n + len, graph[1]);
    for (int i = 0; i <= n + len; ++i) {
      for (auto j : graph[0][i]) {
        merge(i, j);
      }
    }
    for (int i = 0; i <= n + len; ++i) {
      for (auto j : graph[1][i]) {
        edge(get(i), get(j), subgraph);
      }
    }
    bool flag = 0;
    int cnt = 0;
    for (int i = 0; i <= n + len; ++i) {
      if (col[get(i)] != -1) {
        continue;
      }
      col[get(i)] = 0;
      flag |= dfs(get(i));
      cnt++;
    }
    if (flag) {
      continue;
    }
    res += binPow(2, cnt - 1);
    if (res >= mod) {
      res -= mod;
    }
  }
  cout << res << "\n";
  return 0;
}