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;
template <typename T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
const long long MOD = 998244353;
int M;
int par[2010], sz[2010];
int col[2010];
vector<int> g[2010];
vector<pair<int, int>> ed;
inline int find(int a) { return par[a] == a ? a : par[a] = find(par[a]); }
inline void join(int a, int b) {
  a = find(a), b = find(b);
  if (a == b) return;
  if (sz[a] >= sz[b]) swap(a, b);
  sz[b] += sz[a], par[a] = b;
}
bool dfs(int v, int c) {
  if (col[v] == c) return 1;
  if (col[v] == 1 - c) return 0;
  col[v] = c;
  for (int w : g[v]) {
    if (!dfs(w, 1 - c)) return 0;
  }
  return 1;
}
long long pw2[3030];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string ss;
  cin >> ss;
  M = ss.size();
  reverse(ss.begin(), ss.end());
  pw2[0] = 1;
  for (int i = 1; i <= 3000; i++) pw2[i] = pw2[i - 1] * 2 % MOD;
  long long res = 0;
  for (int K = 1; K < M; K++) {
    for (int i = 0; i <= M + K + 1; i++) par[i] = i, sz[i] = 1;
    ed.clear();
    ed.push_back({M + K, M + K + 1});
    for (int i = 0; i < M - 1 - i; i++) {
      join(i, M - 1 - i);
    }
    for (int i = 0; i < K - 1 - i; i++) {
      join(i + M, K - 1 - i + M);
    }
    join(0, M + K + 1);
    join(M, M + K + 1);
    for (int i = 0; i < M; i++) {
      if (ss[i] == '0') {
        if (i < K) {
          join(i, i + M);
        } else {
          join(i, M + K);
        }
      } else if (ss[i] == '1') {
        if (i < K) {
          ed.push_back({i, i + M});
        } else {
          join(i, M + K + 1);
        }
      }
    }
    if (find(M + K) == find(M + K + 1)) continue;
    memset(col, -1, sizeof col);
    for (int i = 0; i <= M + K + 1; i++) g[i].clear();
    for (auto pr : ed) {
      int v = pr.first, w = pr.second;
      v = find(v), w = find(w);
      g[v].push_back(w);
      g[w].push_back(v);
    }
    bool good = 1;
    long long comp = 0;
    for (int i = 0; i <= M + K + 1; i++) {
      int v = find(i);
      if (col[v] != -1) continue;
      comp++;
      if (!dfs(v, 0)) {
        good = 0;
        break;
      }
    }
    if (good && comp >= 1) {
      res = (res + pw2[comp - 1]) % MOD;
    }
  }
  cout << res << '\n';
  return 0;
}