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 N = 1010, MO = 998244353;
char str[N];
int n;
inline int qpow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % MO;
    a = 1ll * a * a % MO;
    b = b >> 1;
  }
  return ans;
}
namespace ufs {
int cnt, fa[N * 2], val[N * 2];
inline void init() {
  for (int i = 1; i <= n * 2 + 1; i++) {
    fa[i] = i;
    val[i] = 0;
  }
  cnt = 2 * n;
  return;
}
int find(int x, int &v) {
  if (x == fa[x]) {
    v = 0;
    return x;
  }
  int t = find(fa[x], v);
  v ^= val[x];
  fa[x] = t;
  val[x] = v;
  return t;
}
inline bool merge(int x, int y, int v) {
  int t, t2;
  x = find(x, t);
  y = find(y, t2);
  t ^= t2;
  if (x == y) {
    if (t != v) return false;
    return true;
  } else {
    fa[x] = y;
    val[x] = v ^ t;
    cnt--;
  }
  return true;
}
}  // namespace ufs
using ufs::merge;
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  std::reverse(str + 1, str + n + 1);
  int ans = 0, Z = 2 * n + 1;
  for (int i = n - 1; i >= 1; i--) {
    ufs::init();
    if (!merge(n, Z, 1)) continue;
    if (!merge(1, Z, 1)) continue;
    if (!merge(n + 1, Z, 1)) continue;
    if (!merge(n + i, Z, 1)) continue;
    int fd = 0;
    for (int j = n; j > i; j--) {
      if (!merge(n + j, Z, 0)) {
        fd = 1;
        break;
      }
    }
    if (fd) continue;
    for (int j = 1; j * 2 <= n; j++) {
      if (!merge(j, n - j + 1, 0)) {
        fd = 1;
        break;
      }
    }
    if (fd) continue;
    for (int j = 1; j * 2 <= i; j++) {
      if (!merge(n + j, n + i - j + 1, 0)) {
        fd = 1;
        break;
      }
    }
    if (fd) continue;
    for (int j = 1; j <= n; j++) {
      if (str[j] != '?') {
        if (!merge(j, n + j, str[j] - '0')) {
          fd = 1;
          break;
        }
      }
    }
    if (fd) continue;
    ans = (ans + qpow(2, ufs::cnt)) % MO;
  }
  printf("%d\n", ans);
  return 0;
}