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 maxn = 1123;
const int MOD = 998244353;
int n, ans;
char s[maxn];
vector<pair<int, int> > G[maxn << 1];
vector<int> adj[maxn << 1];
int vis[maxn << 1], par[maxn << 1], tab[maxn << 1], rec[maxn << 1],
    cc[maxn << 1], pw[maxn << 1];
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline void add(int u, int v, int c) {
  G[u].emplace_back(v, c);
  G[v].emplace_back(u, c);
}
void build(int m) {
  for (int(i) = (1); (i) <= (n + m + 2); (i)++) G[i].clear();
  for (int(i) = (1); (i) <= (m); (i)++) {
    if (s[i] == '0')
      add(i, i + n, 0);
    else if (s[i] == '1')
      add(i + n, i, 1);
    if (m - i + 1 != i) G[i + n].emplace_back(n + m + 1 - i, 0);
  }
  add(n + 1, m + n + 1, 1);
  add(n + 1, m + n + 2, 0);
  for (int(i) = (1); (i) <= (n); (i)++)
    if (i != n - i + 1) G[i].emplace_back(n + 1 - i, 0);
  add(m + n + 1, n + m + 2, 1);
  for (int(i) = (m + 1); (i) <= (n); (i)++) {
    if (s[i] == '0') {
      add(i, n + m + 1, 0);
      add(i, n + m + 2, 1);
    } else if (s[i] == '1') {
      add(i, n + m + 1, 1);
      add(i, n + m + 2, 0);
    }
  }
}
void dfs(int u, int clk, int fa) {
  vis[u] = clk;
  for (auto _ : G[u]) {
    int v = _.first, c = _.second;
    if (!c && vis[v] != clk) {
      par[v] = u;
      dfs(v, clk, fa);
    }
    if (c) adj[fa].emplace_back(v);
  }
}
bool check(int id, int c) {
  cc[id] = c;
  int u = tab[id];
  bool ret = true;
  for (auto v : adj[u]) {
    if (cc[v] == -1)
      ret &= check(v, c ^ 1);
    else if (cc[v] == c)
      ret = false;
  }
  return ret;
}
int Find(int x) { return par[x] == x ? x : par[x] = Find(par[x]); }
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  reverse(s + 1, s + n + 1);
  pw[0] = 1;
  for (int(i) = (1); (i) <= (2 * n); (i)++) pw[i] = add(pw[i - 1], pw[i - 1]);
  for (int(i) = (1); (i) <= (n - 1); (i)++) {
    build(i);
    for (int(j) = (1); (j) <= (n + i + 2); (j)++) {
      par[j] = j;
      adj[j].clear();
    }
    for (int(j) = (1); (j) <= (n + i + 2); (j)++)
      if (vis[j] != i) dfs(j, i, j);
    int sz = 0;
    for (int(j) = (1); (j) <= (n + i + 2); (j)++) {
      if (Find(j) != j) continue;
      tab[++sz] = j;
      rec[j] = sz;
      for (auto &it : adj[j]) it = Find(it);
      sort((adj[j]).begin(), (adj[j]).end());
      (adj[j]).erase(unique((adj[j]).begin(), (adj[j]).end()), (adj[j]).end());
      ;
    }
    for (int(j) = (1); (j) <= (n + i + 2); (j)++)
      for (auto &it : adj[j]) it = rec[it];
    memset(cc, -1, sizeof(cc));
    int ncc = 0;
    bool flag = true;
    for (int(j) = (1); (j) <= (sz); (j)++)
      if (cc[j] == -1) {
        flag &= check(j, 0);
        ncc++;
      }
    if (flag) ans = add(ans, pw[ncc - 1]);
  }
  printf("%d", ans);
}