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 N = 3e3 + 20;
const int MOD = 998244353;
int p[N], col[N], vis[N], sub[N];
vector<int> g[N];
bool oddcycle;
int root(int u) {
  while (p[u] != u) {
    p[u] = p[p[u]];
    u = p[u];
  }
  return u;
}
void merge(int uu, int vv) {
  int u = root(uu), v = root(vv);
  if (u == v) return;
  if (sub[u] < sub[v]) swap(u, v);
  sub[u] += sub[v];
  p[v] = u;
}
void dfs(int node) {
  for (auto it : g[node]) {
    if (vis[it]) {
      if (col[it] == col[node]) oddcycle = true;
    } else {
      col[it] = col[node] ^ 1;
      vis[it] = 1;
      dfs(it);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.length(), i, total = 0;
  for (int st = 1; st <= n; st++) {
    for (i = 0; i <= 2 * n + 1; i++) {
      g[i].clear();
      col[i] = 0;
      vis[i] = 0;
      p[i] = i;
      sub[i] = 1;
    }
    merge(n + 1, 2 * n + 1);
    merge(st, 2 * n + 1);
    for (i = 0; i < n; i++)
      if (s[i] == '0') merge(i + 1, i + n + 1);
    for (i = st; i < n + st - i; i++) merge(i, n + st - i);
    for (i = n + 1; i < 3 * n + 1 - i; i++) merge(i, 3 * n + 1 - i);
    for (i = 1; i < st; i++) merge(i, 0);
    int u = root(0), v = root(2 * n + 1);
    g[u].push_back(v);
    g[v].push_back(u);
    for (i = 0; i < n; i++)
      if (s[i] == '1') {
        int u = root(i + 1), v = root(i + n + 1);
        g[u].push_back(v);
        g[v].push_back(u);
      }
    int cmp = 0, ans = 1;
    oddcycle = false;
    for (i = 0; i <= 2 * n + 1; i++)
      if (!vis[i] && p[i] == i) {
        vis[i] = 1;
        dfs(i);
        cmp++;
      }
    if (oddcycle) {
      continue;
    }
    for (i = 1; i < cmp; i++) {
      ans = ans + ans;
      if (ans >= MOD) ans -= MOD;
    }
    total += ans;
    if (total >= MOD) total -= MOD;
  }
  cout << total << '\n';
  return 0;
}