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;
using ll = long long;
using ii = pair<int, int>;
constexpr int MX = 1005, MOD = 998244353;
int P[2 * MX], p2[2 * MX] = {1}, col[2 * MX];
bitset<2 * MX> vis;
vector<int> C[2 * MX], G[2 * MX][2];
void dfs(int u, int i) {
  P[u] = i, C[i].push_back(u), vis[u] = 1;
  for (int v : G[u][0])
    if (!vis[v]) dfs(v, i);
}
bool check(int u, int c) {
  col[u] = c;
  for (int j : C[u]) {
    for (int v : G[j][1]) {
      if (col[P[v]] == c)
        return 0;
      else if (col[P[v]] == -1 && !check(P[v], !c))
        return 0;
    }
  }
  return 1;
}
void dfs2(int u) {
  vis[u] = 1;
  for (int v : G[u][0])
    if (!vis[v]) dfs2(v);
  for (int v : G[u][1])
    if (!vis[v]) dfs2(v);
}
int main() {
  if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
  cin.tie(0)->sync_with_stdio(0);
  string second;
  cin >> second;
  reverse(begin(second), end(second));
  int m = second.size(), ans = 0;
  for (int i = 1; i < 2 * MX; ++i) p2[i] = 2 * p2[i - 1] % MOD;
  for (int k = 1; k < m; ++k) {
    int n = m + k + 1;
    for (int i = 0; i < n; ++i) G[i][0].clear(), G[i][1].clear();
    for (int i = 0; i < m / 2; ++i)
      G[i][0].push_back(m - 1 - i), G[m - 1 - i][0].push_back(i);
    for (int i = 0; i < k / 2; ++i)
      G[m + i][0].push_back(m + k - 1 - i),
          G[m + k - 1 - i][0].push_back(m + i);
    for (int i = 0; i < m; ++i)
      if (second[i] != '?') {
        bool b = second[i] == '1';
        if (i < k)
          G[i][b].push_back(m + i), G[m + i][b].push_back(i);
        else
          G[i][b].push_back(n - 1), G[n - 1][b].push_back(i);
      }
    G[m][1].push_back(n - 1), G[n - 1][1].push_back(m);
    vis.reset();
    for (int i = 0; i < n; ++i) P[i] = -1, C[i].clear();
    for (int i = 0; i < n; ++i)
      if (!vis[i]) dfs(i, i);
    for (int i = 0; i < n; ++i) col[i] = -1;
    if (!check(0, 0)) {
      cerr << "skipped\n";
      continue;
    }
    int cnt = 0;
    vis.reset();
    for (int i = 0; i < n; ++i)
      if (!vis[i]) dfs2(i), ++cnt;
    cerr << cnt << '\n';
    if (cnt) (ans += p2[cnt - 1]) %= MOD;
  }
  cout << ans;
}