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 mod = 998244353;
char s[1010];
int n, fa[2010], val[2010], pw2[2010], ans = 0;
inline int getf(int x) {
  if (x == fa[x]) return x;
  int f = getf(fa[x]);
  val[x] ^= val[fa[x]];
  fa[x] = f;
  return f;
}
inline int merge(int x, int y, int w) {
  int ti = getf(x), tj = getf(y);
  if (ti == tj) return w == (val[x] ^ val[y]);
  w ^= val[x] ^ val[y];
  fa[ti] = tj;
  val[ti] = w;
  return 1;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  reverse(s + 1, s + n + 1);
  pw2[0] = 1;
  for (int i = 1; i <= n; i++) pw2[i] = (pw2[i - 1] + pw2[i - 1]) % mod;
  int ans = 0;
  for (int lena = n - 1; lena >= 1; lena--) {
    for (int j = 1; j <= ((n << 1) + 1); j++) fa[j] = j, val[j] = 0;
    if (!merge((n), ((n << 1) + 1), 0)) continue;
    if (!merge((n + n), ((n << 1) + 1), 1)) continue;
    bool fail = 0;
    for (int j = 1; j <= n / 2; j++) {
      if (!merge((j + n), (n + 1 - j + n), 0)) {
        fail = 1;
        break;
      }
    }
    if (fail) continue;
    for (int j = 1; j <= lena / 2; j++) {
      if (!merge((j), (lena + 1 - j), 0)) {
        fail = 1;
        break;
      }
    }
    if (fail) continue;
    for (int j = lena + 1; j < n; j++) {
      if (!merge((j), ((n << 1) + 1), 0)) {
        fail = 1;
        break;
      }
    }
    if (!merge((lena), ((n << 1) + 1), 1)) fail = 1;
    if (fail) continue;
    for (int j = 1; j <= n; j++) {
      if (s[j] == '0') {
        if (!merge((j), (j + n), 0)) {
          fail = 1;
          break;
        }
      } else if (s[j] == '1') {
        if (!merge((j), (j + n), 1)) {
          fail = 1;
          break;
        }
      }
    }
    if (fail) continue;
    int cnt = 0;
    for (int j = 1; j <= ((n << 1) + 1); j++)
      if (getf(j) == j && getf(j) != getf(((n << 1) + 1))) cnt++;
    ans = (ans + pw2[cnt]) % mod;
  }
  printf("%d\n", ans);
  return 0;
}