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 int MOD = 998244353;
int n;
char s[1005];
int a[1005], b[1005];
int currLen;
bool seta(int, int);
bool setb(int pos, int value) {
  if (pos >= currLen) return true;
  int pos2 = currLen - 1 - pos;
  if (b[pos] == (value ^ 1)) return false;
  if (b[pos2] == (value ^ 1)) return false;
  if (b[pos] == -1) {
    b[pos] = value;
    if (s[pos] != '?') {
      if (!seta(pos, (s[pos] - '0') ^ b[pos])) return false;
    }
  }
  if (b[pos2] == -1) {
    b[pos2] = value;
    if (s[pos2] != '?') {
      if (!seta(pos2, (s[pos2] - '0') ^ b[pos2])) return false;
    }
  }
  return true;
}
bool seta(int pos, int value) {
  int pos2 = n - 1 - pos;
  if (a[pos] == (value ^ 1)) return false;
  if (a[pos2] == (value ^ 1)) return false;
  if (a[pos] == -1) {
    a[pos] = value;
    if (s[pos] != '?') {
      if (!setb(pos, (s[pos] - '0') ^ a[pos])) return false;
    }
  }
  if (a[pos2] == -1) {
    a[pos2] = value;
    if (s[pos2] != '?') {
      if (!setb(pos2, (s[pos2] - '0') ^ a[pos2])) return false;
    }
  }
  return true;
}
long long solve(int len) {
  currLen = len;
  memset(a, -1, sizeof(a));
  memset(b, -1, sizeof(b));
  setb(0, 1);
  long long score = 1;
  for (int i = n - 1; i >= len; i--) {
    if (s[i] != '?') {
      if (!seta(i, s[i] - '0')) return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == -1) {
      if (!seta(i, 0)) throw "";
      score *= 2;
      score %= MOD;
    }
    if (i < len && b[i] == -1) {
      if (!setb(i, 0)) throw "";
      score *= 2;
      score %= MOD;
    }
  }
  return score;
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  std::reverse(s, s + n);
  long long score = 0;
  for (int i = 1; i < n; i++) {
    long long s = solve(i);
    score += s;
    score %= MOD;
  }
  printf("%lld\n", score);
  return 0;
}