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 N = 2005, mod = 998244353;
int a[N], b[N], pa[N], w[N], bin[N];
int n, m, ans;
char s[N];
inline int getpa(int x) {
  if (pa[x] == x) return x;
  int p = getpa(pa[x]);
  w[x] ^= w[pa[x]];
  return pa[x] = p;
}
inline int link(int a, int b, int c) {
  if (getpa(a) != getpa(b)) {
    w[pa[a]] = w[a] ^ w[b] ^ c;
    pa[pa[a]] = pa[b];
  } else if (w[a] ^ w[b] ^ c)
    return 0;
  return 1;
}
int solve(int A, int B) {
  memset(pa, 0, sizeof pa);
  memset(w, 0, sizeof w);
  for (int i = (1); i <= (B * 2 + 3); i++) pa[i] = i;
  m = 0;
  int zero = ++m;
  for (int i = (0); i <= (B); i++) a[i] = ++m, (i > A ? link(zero, m, 0) : 0);
  for (int i = (0); i <= (B); i++) b[i] = ++m;
  link(zero, a[0], 1), link(zero, b[0], 1);
  for (int i = 0, j = A; i < j; i++, j--)
    if (!link(a[i], a[j], 0)) return 0;
  for (int i = 0, j = B; i < j; i++, j--)
    if (!link(b[i], b[j], 0)) return 0;
  for (int i = (0); i <= (B); i++)
    if (s[i] != '?' && !link(a[i], b[i], s[i] - '0')) return 0;
  int owo = 0;
  for (int i = (1); i <= (m); i++) owo += (pa[i] == i);
  return bin[owo - 1];
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  reverse(s, s + n);
  bin[0] = 1;
  for (int i = (1); i <= (n * 2); i++) bin[i] = bin[i - 1] * 2 % mod;
  for (int i = (1); i <= (n - 1); i++) ans = (ans + solve(i - 1, n - 1)) % mod;
  printf("%d\n", ans);
  return 0;
}