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>
struct edge {
  int to, val;
};
char st[5005];
std::vector<edge> a[5005];
int n, f[5005], col[5005], can[5005], flag = 1, k;
long long ans = 0;
int t(int x, int opt) { return x + opt * k; }
void color(int v, int c) {
  if (col[v] != -1) return flag = !(col[v] == c), void();
  col[v] = c;
  for (int i = 0; i < a[v].size(); i++) {
    int u = a[v][i].to, x = a[v][i].val;
    color(u, c ^ x);
    if (flag) return;
  }
}
void add(int x, int y, int v) {
  if (!can[x] || !can[y]) return;
  a[x].push_back(edge{y, v});
  a[y].push_back(edge{x, v});
}
long long solve(int n, int m) {
  for (int i = 1; i <= k * 2; i++) col[i] = -1, can[i] = 0;
  for (int i = 1; i <= k * 2; i++) a[i].clear();
  for (int i = 1; i <= n; i++) can[i] = 1;
  for (int i = 1; i <= m; i++) can[2 * k - i + 1] = 1;
  flag = 0;
  for (int i = 1; i <= n / 2; i++) add(t(i, 0), t(k - i + 1, 0), 0);
  for (int i = 1; i <= m / 2; i++) add(t(k - m + i, 1), t(k - i + 1, 1), 0);
  for (int i = 1; i <= k; i++)
    if (f[i] == 0)
      add(t(i, 0), t(i, 1), 0);
    else if (f[i] == 1)
      add(t(i, 0), t(i, 1), 1);
  color(t(1, 0), 1);
  if (flag) return 0;
  color(t(k - m + 1, 1), 1);
  if (flag) return 0;
  for (int i = 1; i <= n - m; i++) {
    if (f[i] == -1) continue;
    color(i, f[i]);
    if (flag) return 0;
  }
  long long ans = 1;
  for (int i = 1; i <= k * 2; i++) {
    if (k < i && i < 2 * k - m + 1) continue;
    if (col[i] != -1) continue;
    color(i, 1);
    if (flag) return 0;
    ans = ans * 2 % 998244353;
  }
  return ans;
}
int main() {
  scanf("%s", st + 1);
  k = strlen(st + 1);
  for (int i = 1; i <= k; i++)
    if (st[i] == '1')
      f[i] = 1;
    else if (st[i] == '0')
      f[i] = 0;
    else
      f[i] = -1;
  for (int i = 1; i <= k; i++) ans = (ans + solve(k, i)) % 998244353;
  printf("%lld\n", ans);
  return 0;
}