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 = 1e6 + 100;
const int mod = 998244353;
struct DSU {
  int n, comp, bad_comp;
  vector<int> par, bad;
  void init(int nn) {
    n = nn, comp = (n << 1), bad_comp = 0;
    par.assign(n << 1, 0);
    bad.assign(n << 1, 0);
    for (int i = 0; i < (n << 1); i++) par[i] = i;
  }
  void addEdge(int u, int v, bool diff) {
    Merge(u << 1, (v << 1) ^ diff);
    Merge((u << 1) ^ 1, (v << 1) ^ 1 ^ diff);
  }
  void Set(int u, bool f) {
    int p = P((u << 1) ^ f ^ 1);
    if (!bad[p]) bad_comp++, bad[p] = true;
  }
  int P(int u) {
    if (par[u] == u) return u;
    return par[u] = P(par[u]);
  }
  void Merge(int u, int v) {
    u = P(u), v = P(v);
    if (u == v) return;
    comp--;
    par[v] = u;
    if (bad[u] && bad[v]) bad_comp--;
    bad[u] |= bad[v];
  }
  bool Bad() {
    for (int i = 0; i < n; i++)
      if (P(i << 1) == P((i << 1) ^ 1)) return true;
    return false;
  }
  int ways() {
    if (Bad()) return 0;
    for (int v = 0; v < n; v++) {
      if (bad[P(v << 1)] && bad[P((v << 1) ^ 1)]) return 0;
    }
    int good = (comp - 2 * bad_comp) / 2;
    int ret = 1;
    for (int i = 1; i <= good; i++) {
      ret = 1ll * ret * 2 % mod;
    }
    return ret;
  }
} dsu;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  for (int len = n - 1; len >= 1; len--) {
    dsu.init(len + n);
    for (int i = 0, j = n - 1; i < j; i++, j--) {
      dsu.addEdge(i, j, 0);
    }
    for (int i = n, j = n + len - 1; i < j; i++, j--) {
      dsu.addEdge(i, j, 0);
    }
    dsu.Set(0, 1);
    dsu.Set(n, 1);
    for (int i = n - 1, j = n + len - 1; i >= 0; i--, j--) {
      if (s[i] == '?') continue;
      if (j < n) {
        dsu.Set(i, s[i] - '0');
      } else {
        dsu.addEdge(i, j, s[i] - '0');
      }
    }
    int x = dsu.ways();
    ans += x;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}