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>
inline long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
char s[1010];
int n, ans;
int I, A[1010], B[1010], cnt, fir[2010], nxt[100010], dis[100010], id;
bool w[100010];
inline void link(int a, int b, int c) {
  nxt[++id] = fir[a], fir[a] = id, dis[id] = b, w[id] = c;
  nxt[++id] = fir[b], fir[b] = id, dis[id] = a, w[id] = c;
}
int p2[2010];
bool vis[2010], col[2010];
inline bool dfs(int x) {
  for (int i = fir[x]; i; i = nxt[i])
    if (!vis[dis[i]]) {
      vis[dis[i]] = 1;
      col[dis[i]] = col[x] ^ w[i];
      if (dfs(dis[i])) return 1;
    } else if (col[dis[i]] ^ col[x] ^ w[i])
      return 1;
  return 0;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  p2[0] = 1;
  for (int i = 1; i <= 2000; ++i) p2[i] = p2[i - 1] * 2 % 998244353;
  for (int pa = 2; pa <= n; ++pa) {
    memset(fir, 0, sizeof fir);
    id = cnt = 0;
    I = cnt++;
    for (int i = pa; i <= n; ++i) A[i] = cnt++;
    for (int i = 1; i <= n; ++i) B[i] = cnt++;
    link(B[1], I, 1);
    link(A[pa], I, 1);
    for (int i = pa; i <= n; ++i)
      if (s[i] == '0')
        link(A[i], B[i], 0);
      else if (s[i] == '1')
        link(A[i], B[i], 1);
    for (int i = 1; i < pa; ++i)
      if (s[i] == '0')
        link(B[i], I, 0);
      else if (s[i] == '1')
        link(B[i], I, 1);
    for (int i = pa, j = n; i < j; ++i, --j) link(A[i], A[j], 0);
    for (int i = 1, j = n; i < j; ++i, --j) link(B[i], B[j], 0);
    memset(vis, 0, sizeof vis);
    int C = 0;
    for (int i = 0; i < cnt; ++i)
      if (!vis[i]) {
        ++C;
        if (dfs(i)) {
          C = -1;
          break;
        }
      }
    if (~C) ans = (ans + p2[C - 1]) % 998244353;
  }
  printf("%d\n", ans);
  return 0;
}