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>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
namespace _c {
const double pi = acos(-1.0);
namespace min {
const int i8 = -128;
const int i16 = -32768;
const int i = -2147483647 - 1;
const long long l = -9223372036854775807LL - 1;
}  // namespace min
namespace max {
const int i8 = 127;
const int i16 = 32767;
const int i = 2147483647;
const long long l = 9223372036854775807LL;
}  // namespace max
}  // namespace _c
namespace _f {
template <typename T>
inline const T gcd(T m, T n) {
  while (n != 0) {
    T t = m % n;
    m = n;
    n = t;
  }
  return m;
}
template <typename T>
inline const T abs(const T &a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T pow(T a, T b) {
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
template <typename T>
inline T pow(T a, T b, const T &m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a % m;
    }
    a = a * a % m;
    b >>= 1;
  }
  return res % m;
}
}  // namespace _f
namespace io {
template <typename T>
inline T read() {
  register T res = 0, neg = 1;
  char g = getchar();
  for (; !isdigit(g); g = getchar()) {
    if (g == '-') {
      neg = -1;
    }
  }
  for (; isdigit(g); g = getchar()) {
    res = res * 10 + g - '0';
  }
  return res * neg;
}
template <typename T>
inline void read(T &t) {
  t = read<T>();
}
template <typename T>
inline void readln(const T first, const T last) {
  for (register T it = first; it != last; it++) {
    read(*it);
  }
}
template <typename T>
inline void _write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    _write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T>
inline void write(const T &x, const char &sep = ' ') {
  _write(x);
  putchar(sep);
}
template <typename T>
inline void writeln(const T &x) {
  write(x, '\n');
}
template <typename T>
inline void writeln(const T first, const T last, const char &sep = ' ',
                    const char &ends = '\n') {
  for (register T it = first; it != last; it++) {
    write(*it, sep);
  }
  putchar(ends);
}
}  // namespace io
const int MOD = 998244353;
const int N = 2e3 + 5;
char s[N];
int vis[N];
unordered_map<int, vector<pair<int, int>>> g;
inline void add_edge(int u, int v, int c) {
  g[u].emplace_back(pair<int, int>{v, c});
  g[v].emplace_back(pair<int, int>{u, c});
}
inline int check(int u) {
  if (vis[u] == -1) {
    vis[u] = 0;
  }
  for (auto e : g[u]) {
    if (vis[e.first] == -1) {
      vis[e.first] = e.second ? vis[u] ^ 1 : vis[u];
      if (check(e.first) == 0) {
        return 0;
      }
    } else {
      if ((e.second && vis[e.first] == vis[u]) ||
          (!e.second && vis[e.first] != vis[u])) {
        return 0;
      }
    }
  }
  return 1;
}
inline long long Pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) {
      (ret *= a) %= MOD;
    }
    (a *= a) %= MOD;
    b >>= 1;
  }
  return ret;
}
inline long long solve(int n, int m) {
  g.clear();
  for (int i = 1; i <= n >> 1; i++) {
    add_edge(i, n + 1 - i, 0);
  }
  for (int i = 1; i <= m >> 1; i++) {
    add_edge(n + n - m + i, n + n + 1 - i, 0);
  }
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] != '?') {
      add_edge(i, i + n, s[i - 1] - '0');
    }
  }
  add_edge((n << 1) + 1, 1, 0);
  add_edge((n << 1) + 1, n + n - m + 1, 0);
  for (int i = 1; i <= n - m; i++) {
    add_edge((n << 1) + 2, i + n, 0);
  }
  int cnt = 0;
  memset(vis, -1, sizeof(vis));
  for (int i = 1; i <= (n << 1) + 2; i++) {
    if (vis[i] == -1) {
      if (check(i)) {
        cnt++;
      } else {
        return 0;
      }
    }
  }
  return Pow(2, cnt - 1);
}
int main() {
  scanf("%s", s);
  int len = strlen(s);
  long long ans = 0;
  for (int i = 1; i < len; i++) {
    (ans += solve(len, i)) %= MOD;
  }
  io::writeln(ans % MOD);
}