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;
struct Graph {
  vector<vector<int>> adj;
  vector<int> val;
  int n;
  string s;
  Graph() {}
  Graph(int n_) {
    n = n_;
    adj.resize(n);
    val.assign(n, -1);
  }
  void ae(int a, int b) {
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int getVal(int i) { return s[i] - '0'; }
  bool dfs(int v, int cur) {
    if (val[v] != -1 && val[v] != cur) return false;
    if (val[v] != -1) return true;
    val[v] = cur;
    for (auto u : adj[v]) {
      int vv;
      if (v < s.size() && u >= s.size()) vv = (cur ^ getVal(v));
      if (u < s.size() && v >= s.size()) vv = (cur ^ getVal(u));
      if (v < s.size() && u < s.size()) vv = cur;
      if (v >= s.size() && u >= s.size()) vv = cur;
      if (!dfs(u, vv)) return false;
    }
    return true;
  }
};
string s;
int n;
int ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  n = s.size();
  reverse(s.begin(), s.end());
  for (int i = 0; i < n - 1; i++) {
    Graph G(n + i + 1);
    G.s = s;
    for (int j = 0; j < ((i + 1) / 2); j++) {
      G.ae(j + n, i - j + n);
    }
    for (int j = 0; j <= i; j++) {
      if (s[j] == '1' || s[j] == '0') G.ae(j, j + n);
    }
    for (int j = 0; j < ((n) / 2); j++) G.ae(j, n - 1 - j);
    int curans = 1;
    if (G.dfs(n, 1))
      curans *= 1;
    else
      curans *= 0;
    for (int j = i + 1; j < n; j++) {
      if (s[j] == '?') continue;
      if (G.dfs(j, s[j] - '0'))
        curans *= 1;
      else
        curans *= 0;
    }
    for (int j = 0; j < (n + i + 1); j++) {
      if (G.val[j] == -1) {
        if (G.dfs(j, 1))
          curans *= 2;
        else
          curans *= 0;
        if (curans >= 998244353) curans -= 998244353;
      }
    }
    ans += curans;
    if (ans >= 998244353) ans -= 998244353;
  }
  cout << ans << endl;
}