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>
const int maxv = 2010, maxe = 10005;
const long long mod = 998244353LL;
char s[maxv];
int n, fa[maxv], p0, p1;
int head[maxv], next[maxe], to[maxe], lb, clr[maxv];
struct Edge {
  int u, v;
} e[2][maxe];
int nume[2];
inline void addNewEdge(int id, int u, int v) {
  Edge& edge = e[id][nume[id]];
  edge.u = u;
  edge.v = v;
  ++nume[id];
}
int getfa(int aa) { return fa[aa] == aa ? aa : fa[aa] = getfa(fa[aa]); }
inline void ist(int aa, int ss) {
  to[lb] = ss;
  next[lb] = head[aa];
  head[aa] = lb;
  ++lb;
}
bool dfs(int r, int c) {
  clr[r] = c;
  for (int j = head[r]; j != -1; j = next[j]) {
    if (clr[to[j]] == c) {
      return false;
    }
    if (clr[to[j]] == -1) {
      if (!dfs(to[j], c ^ 1)) {
        return false;
      }
    }
  }
  return true;
}
inline int countComponent() {
  memset(clr, -1, sizeof(clr[0]) * (p1 + 2));
  int rt = 0;
  for (int i = 1; i <= p1; ++i) {
    if (getfa(i) != i) {
      continue;
    }
    if (clr[i] == -1) {
      if (!dfs(i, 0)) {
        return -1;
      }
      ++rt;
    }
  }
  return rt;
}
inline long long poww(long long di, long long mi) {
  if (mi == 0) {
    return 1LL;
  }
  int i;
  for (i = 62; ((mi >> i & 1) ^ 1); --i)
    ;
  long long rt = di;
  for (--i; i >= 0; --i) {
    rt = (rt * rt) % mod;
    if (mi >> i & 1) {
      rt = rt * di % mod;
    }
  }
  return rt;
}
inline long long work(int lena) {
  p0 = n + lena + 1;
  p1 = p0 + 1;
  memset(head, -1, sizeof(head[0]) * (p1 + 2));
  lb = 0;
  for (int i = 1; i <= p1; ++i) {
    fa[i] = i;
  }
  memset(nume, 0, sizeof nume);
  for (int i = 1; i <= n / 2; ++i) {
    addNewEdge(0, i, n + 1 - i);
  }
  for (int i = 1; i <= lena / 2; ++i) {
    addNewEdge(0, i + n, lena + 1 - i + n);
  }
  for (int i = 1; i <= n - lena; ++i) {
    if (s[i] == '0') {
      addNewEdge(0, i, p0);
    } else if (s[i] == '1') {
      addNewEdge(0, i, p1);
    }
  }
  for (int i = n - lena + 1; i <= n; ++i) {
    if (s[i] == '0') {
      addNewEdge(0, i, i + lena);
    } else if (s[i] == '1') {
      addNewEdge(1, i, i + lena);
    }
  }
  addNewEdge(1, p0, p1);
  addNewEdge(0, p1, n + lena);
  for (int i = 0; i < nume[0]; ++i) {
    int fu = getfa(e[0][i].u);
    int fv = getfa(e[0][i].v);
    if (fu != fv) {
      fa[fu] = fv;
    }
  }
  for (int i = 0; i < nume[1]; ++i) {
    int fu = getfa(e[1][i].u);
    int fv = getfa(e[1][i].v);
    if (fu == fv) {
      return 0;
    }
    ist(fu, fv);
    ist(fv, fu);
  }
  int numc = countComponent();
  if (numc == -1) {
    return 0;
  }
  return poww(2, numc - 1);
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  long long ans = 0, tans;
  for (int i = 1; i < n; ++i) {
    tans = work(i);
    ans = (ans + tans) % mod;
  }
  printf("%d\n", (int)(ans % mod));
  return 0;
}