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 mod = 998244353;
struct Edge {
  int go, next;
} e[80010];
int head[8010], tot, col[8010];
long long pw[4010];
void add(int x, int y) {
  e[++tot].go = y;
  e[tot].next = head[x];
  head[x] = tot;
}
void da(int x, int y) {
  add(x, y);
  add(y, x);
}
void init() {
  memset(head, 0, sizeof(head));
  memset(col, 0, sizeof(col));
  tot = 0;
}
char a[1010];
bool dfs(int x, int t) {
  col[x] = t;
  for (int i = head[x]; i; i = e[i].next) {
    int v = e[i].go;
    if (col[v] == 0) {
      bool f = dfs(v, -t);
      if (!f) return false;
    } else if (col[v] == t)
      return false;
  }
  return true;
}
int one = 8001;
int main() {
  scanf("%s", a + 1);
  int n = strlen(a + 1);
  pw[0] = 1;
  for (int i = 1; i <= 4000; i++) pw[i] = pw[i - 1] * 2 % mod;
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    init();
    int cnt = n + i;
    for (int j = 1; j <= n; j++) {
      da(j, ++cnt);
      da(cnt, n + 1 - j);
      if (j <= i) {
        da(n + j, ++cnt);
        da(cnt, n + (i + 1 - j));
        if (a[n + 1 - j] == '0') {
          da(j, ++cnt);
          da(cnt, n + j);
        }
        if (a[n + 1 - j] == '1') {
          da(j, n + j);
        }
      } else {
        if (a[n + 1 - j] == '0') da(j, one);
        if (a[n + 1 - j] == '1') da(j, 0);
      }
    }
    da(n + 1, 0);
    da(0, one);
    int c = 0;
    bool fl = 1;
    fl &= dfs(one, 1);
    for (int j = 1; j <= n + i; j++) {
      if (col[j]) continue;
      fl &= dfs(j, 1);
      if (!fl) break;
      c++;
    }
    if (fl) ans = (ans + pw[c]) % mod;
  }
  printf("%lld", ans);
  return 0;
}