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 long long mod = 998244353;
char s[1005];
int p[4005];
int find(int u) {
  if (p[u] == u)
    return u;
  else
    return p[u] = find(p[u]);
}
void merge(int u, int v) { p[find(v)] = find(u); }
int preWork(int n, int m) {
  for (int i = 1; i <= 4 * n; i++) p[i] = i;
  int mid = m / 2;
  for (int i = 1; i <= mid; i++) {
    int j = m - i + 1;
    int pi = i + n - m, pj = j + n - m;
    merge(pi, pj);
    merge(pi + n, pj + n);
  }
  mid = n / 2;
  for (int i = 1; i <= mid; i++) {
    int j = n - i + 1;
    merge(i + 2 * n, j + 2 * n);
    merge(i + 3 * n, j + 3 * n);
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      merge(i, i + 2 * n);
      merge(i + n, i + 3 * n);
    } else if (s[i] == '1') {
      merge(i, i + 3 * n);
      merge(i + n, i + 2 * n);
    }
  }
  int t = 4 * n + 1, f = 4 * n + 2;
  p[t] = t, p[f] = f;
  for (int i = 1; i <= n - m; i++) {
    merge(t, i);
    merge(f, i + n);
  }
  if (m != 0) merge(f, n - m + 1);
  if (m != 0) merge(t, n - m + 1 + n);
  merge(f, 1 + 2 * n);
  merge(t, 1 + 3 * n);
  int ok = find(t) != find(f);
  for (int i = 1; i <= n; i++) {
    if (find(i) == find(i + n)) ok = 0;
    if (find(i + 2 * n) == find(i + 3 * n)) ok = 0;
  }
  return ok;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    if (preWork(n, i)) {
      long long way = 1;
      int t = 4 * n + 1, f = 4 * n + 2;
      for (int i = 1; i <= n; i++) {
        int u = find(i), v = find(i + n);
        if (u != t && v != t) {
          way = way * 2 % mod;
          merge(t, u);
          merge(f, v);
        }
        u = find(i + 2 * n), v = find(i + 3 * n);
        if (u != t && v != t) {
          way = way * 2 % mod;
          merge(t, u);
          merge(f, v);
        }
      }
      ans += way;
      if (ans >= mod) ans -= mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}