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;
namespace IO {
template <typename T>
void __RI(T &x) {
  int ch = getchar(), neg = 1;
  x = 0;
  for (; !(isdigit(ch) || ch == '-' || ch == EOF); ch = getchar())
    ;
  if (ch == EOF) return;
  if (ch == '-') neg = -1, ch = getchar();
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
  x *= neg;
}
void R(int &x) { __RI(x); }
void R(int64_t &x) { __RI(x); }
template <typename T1, typename T2>
void R(std::pair<T1, T2> &x) {
  R(x.first);
  R(x.second);
}
template <typename T>
void R(std::vector<T> &x) {
  for (auto &i : x) {
    R(i);
  }
}
template <typename T>
void R(T &x) {
  std::cin >> x;
}
template <typename T, typename... Args>
void R(T &x, Args &...args) {
  R(x), R(args...);
}
char space = ' ';
template <typename T>
void __WI(T x) {
  if (x == 0) putchar('0');
  if (x < 0) putchar('-'), x = -x;
  char ch[64];
  int pos = 0;
  while (x) ch[pos++] = x % 10 + 48, x /= 10;
  while (pos) putchar(ch[--pos]);
}
void W() {}
void W(const int &x) { __WI(x); }
void W(const int64_t &x) { __WI(x); }
void W(const double &x) { printf("%lf", static_cast<double>(x)); }
void W(const char &x) { putchar(x); }
void W(const std::string &x) { printf("%s", x.c_str()); }
template <typename T1, typename T2>
void W(const std::pair<T1, T2> &x) {
  W(x.first);
  W(space);
  W(x.second);
}
template <typename T>
void W(const std::vector<T> &x) {
  for (auto it = x.cbegin(); it != x.cend(); it++) {
    W(*it);
    W(space);
  }
  W('\n');
}
template <typename T>
void W(const T &x) {
  std::cout << x;
}
template <typename T, typename... Args>
void W(const T &x, const Args &...args) {
  W(x), W(space), W(args...);
}
template <typename... Args>
void WL(const Args &...args) {
  W(args...), W('\n');
}
};  // namespace IO
char s[2010];
int n, n2, ans;
int fa[2010], tp[2010];
int p[2010];
int find(int x) {
  if (fa[x] == x) return x;
  int y = find(fa[x]);
  tp[x] ^= tp[fa[x]];
  fa[x] = y;
}
bool unite(int x, int y, int op) {
  int px = find(x), py = find(y);
  if (px != py) return fa[py] = px, tp[py] = op ^ tp[x] ^ tp[y], 1;
  return tp[x] ^ tp[y] ^ (!op) & 1;
}
int solve(int len) {
  for (int i = 1; i <= n2; i++) fa[i] = i, tp[i] = 0;
  for (int i = 1; 2 * i <= n; i++) unite(i, n - i + 1, 0);
  for (int i = 1; 2 * i <= n - len + 1; i++)
    unite(len + i - 1 + n, n2 - i + 1, 0);
  for (int i = 1; i <= n; i++)
    if (s[i] != '?')
      if (!unite(i, i + n, s[i] - '0')) return 0;
  for (int i = 1; i < len - 1; i++)
    if (!unite(i + n, i + 1 + n, 0)) return 0;
  if (!unite(1, 1 + n, 1)) return 0;
  if (!unite(len - 1 + n, len + n, 1)) return 0;
  int cnt = 0;
  for (int i = 1; i <= n2; i++)
    if (fa[i] == i) cnt++;
  return p[cnt - 1];
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  n2 = n * 2;
  p[0] = 1;
  for (int i = 1; i <= n2; i++) p[i] = p[i - 1] * 2 % 998244353;
  for (int i = 2; i <= n; i++) ans = (ans + solve(i)) % 998244353;
  cout << ans << endl;
  return 0;
}