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;
char s[2222];
int fa[2222], top[2222], n, ans, pw2[2222];
const int md = 998244353;
int fd(int x) {
  if (fa[x] == x) return x;
  int y = fd(fa[x]);
  top[x] ^= top[fa[x]];
  fa[x] = y;
}
bool uni(int x, int y, int op) {
  int px = fd(x), py = fd(y);
  if (px != py) return fa[py] = px, top[py] = op ^ top[x] ^ top[y], 1;
  return top[x] ^ top[y] ^ (!op) & 1;
}
inline void init() {
  for (int i = 1; i <= (n << 1); ++i) fa[i] = i, top[i] = 0;
}
inline int sol(int st) {
  init();
  for (int i = 1; (i << 1) <= n; ++i) uni(i, n - i + 1, 0);
  for (int i = 1; (i << 1) <= n - st + 1; ++i)
    uni(st + i - 1 + n, (n << 1) - i + 1, 0);
  for (int i = 1; i <= n; ++i)
    if (s[i] != '?')
      if (!uni(i, i + n, s[i] - '0')) return 0;
  for (int i = 1; i < st - 1; ++i)
    if (!uni(i + n, i + 1 + n, 0)) return 0;
  if (!uni(1, 1 + n, 1)) return 0;
  if (!uni(st - 1 + n, st + n, 1)) return 0;
  int cnt = 0;
  for (int i = 1; i <= (n << 1); ++i)
    if (fa[i] == i) ++cnt;
  return pw2[cnt - 1];
}
inline void add(int& x, int y) {
  x += y;
  if (x >= md) x -= md;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  pw2[0] = 1;
  for (int i = 1; i <= (n << 1); ++i) pw2[i] = (pw2[i - 1] << 1) % md;
  for (int i = 2; i <= n; ++i) add(ans, sol(i));
  printf("%d\n", ans);
}