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>
static const long long int mod = 998244353LL;
struct uset {
  int rank;
  std::pair<int, int> p;
} v[2003];
int n;
std::pair<int, int> getrep(int i) {
  if (v[i].p.first == i) return v[i].p;
  std::pair<int, int> p = getrep(v[i].p.first);
  v[i].p = std::make_pair(p.first, p.second ^ v[i].p.second);
  return v[i].p;
}
bool merge(int a, int b, int x) {
  std::pair<int, int> p1 = getrep(a), p2 = getrep(b);
  if (p1.first == p2.first) {
    return (p1.second ^ p2.second) == x;
  }
  a = p1.first, b = p2.first;
  if (v[a].rank < v[b].rank) std::swap(a, b);
  v[b].p = std::make_pair(a, x ^ p1.second ^ p2.second);
  if (v[a].rank == v[b].rank) ++v[a].rank;
  return true;
}
char s[1003];
int main() {
  scanf("%s", s);
  n = strlen(s);
  long long int sum = 0;
  for (int i = 1; i <= n - 1; ++i) {
    for (int j = 0; j < i + n + 1; ++j) {
      v[j].rank = 0;
      v[j].p = std::make_pair(j, 0);
    }
    bool conf = false;
    for (int j = 0; j < n; ++j)
      if (!merge(j, n - 1 - j, 0)) {
        conf = true;
        break;
      }
    for (int j = 0; j < i; ++j)
      if (!merge(n + j, n + i - 1 - j, 0)) {
        conf = true;
        break;
      }
    if (!merge(n, n + i, 1)) {
      conf = true;
      break;
    }
    for (int j = 0; j < n; ++j)
      if (s[j] != '?') {
        if (j >= n - i) {
          if (!merge(j, j + i, s[j] - '0')) {
            conf = true;
            break;
          }
        } else {
          if (!merge(j, n + i, s[j] - '0')) {
            conf = true;
            break;
          }
        }
      }
    long long int ans;
    if (conf) {
      ans = 0;
    } else {
      ans = 1;
      for (int j = 0; j < n + i; ++j) {
        std::pair<int, int> q = getrep(j);
        std::pair<int, int> p = getrep(n + i);
        if (p.first == q.first) continue;
        ans = ans * 2 % mod;
        merge(p.first, q.first, 0);
      }
    }
    sum += ans;
  }
  printf("%d\n", (int)(sum % mod));
}