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;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
namespace ModCalculator {
const int MOD = 998244353;
inline void Inc(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
  Inc(x, y);
  return x;
}
inline int Sub(int x, int y) {
  Dec(x, y);
  return x;
}
inline int Mul(int x, int y) { return 1LL * x * y % MOD; }
inline int ksm(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1) {
    if (k & 1) ret = Mul(ret, x);
    x = Mul(x, x);
  }
  return ret;
}
inline int Inv(int x) { return ksm(x, MOD - 2); }
}  // namespace ModCalculator
using namespace ModCalculator;
char s[N];
int n, vis[N], q[N], head, tail;
struct Edge {
  int v, w, nxt;
} e[N * 5];
int first[N], eCnt;
inline void AddEdge(int u, int v, int w) {
  e[++eCnt].v = v;
  e[eCnt].w = w;
  e[eCnt].nxt = first[u];
  first[u] = eCnt;
}
inline void Add(int u, int v, int w) {
  AddEdge(u, v, w);
  AddEdge(v, u, w);
}
bool Check(int st) {
  q[head = tail = 1] = st;
  vis[st] = 0;
  while (head <= tail) {
    int u = q[head++];
    for (int i = first[u]; i; i = e[i].nxt) {
      int v = e[i].v, w = e[i].w;
      if (~vis[v]) {
        if (vis[u] ^ vis[v] ^ w) return 0;
      } else {
        vis[v] = vis[u] ^ w;
        q[++tail] = v;
      }
    }
  }
  return 1;
}
int Calc(int m) {
  memset(first, eCnt = 0, sizeof(first));
  int S = n + m + 1;
  for (int i = 1; i <= n / 2; ++i) {
    Add(i, n - i + 1, 0);
  }
  for (int i = 1; i <= m / 2; ++i) {
    Add(n + i, n + m - i + 1, 0);
  }
  for (int i = 1; i <= m; ++i) {
    if (s[n - i + 1] == '?') continue;
    Add(i, n + i, s[n - i + 1] - '0');
  }
  for (int i = m + 1; i <= n; ++i) {
    if (s[n - i + 1] == '?') continue;
    Add(i, S, s[n - i + 1] - '0');
  }
  Add(n + 1, S, 1);
  memset(vis, -1, sizeof(vis));
  int ret = 0;
  for (int i = 1; i <= S; ++i) {
    if (~vis[i]) continue;
    if (!Check(i)) return 0;
    ++ret;
  }
  return ksm(2, ret - 1);
}
void solve() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    Inc(ans, Calc(i));
  }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}