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 V_MAX = 5005;
const int MOD = 998244353;
int N, V;
string S;
vector<int> adj[V_MAX];
vector<int> parity;
void add_edge(int a, int b) {
  adj[a].push_back(b);
  adj[b].push_back(a);
}
void equal(int a, int b) {
  add_edge(a, V);
  add_edge(b, V);
  V++;
}
bool dfs(int node, int p) {
  parity[node] = p;
  for (int neighbor : adj[node]) {
    if (parity[neighbor] == p) return false;
    if (parity[neighbor] < 0) {
      if (!dfs(neighbor, 1 - p)) return false;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> S;
  N = S.size();
  if (S.back() == '1') {
    cout << 0 << '\n';
    return 0;
  }
  long long total = 0;
  for (int length = 1; length < N; length++) {
    for (int i = 0; i < V_MAX; i++) adj[i].clear();
    V = N + length + 2;
    int zero = V - 2, one = V - 1;
    add_edge(zero, one);
    equal(0, one);
    equal(N - 1, one);
    equal(N, one);
    equal(N + length - 1, one);
    for (int i = 1; i < N - length; i++)
      if (S[i] != '?') equal(i, S[i] == '0' ? zero : one);
    for (int i = N - length; i < N; i++)
      if (S[i] == '0')
        equal(i, i + length);
      else if (S[i] == '1')
        add_edge(i, i + length);
    for (int i = 0, j = N - 1; i < j; i++, j--) equal(i, j);
    for (int i = 0, j = length - 1; i < j; i++, j--) equal(N + i, N + j);
    parity.assign(V, -1);
    bool valid = dfs(zero, 0);
    int components = 0;
    for (int i = 0; i < V; i++)
      if (parity[i] < 0) {
        components++;
        valid = valid && dfs(i, 0);
      }
    if (!valid) continue;
    long long now = 1;
    for (int i = 0; i < components; i++) now = 2 * now % MOD;
    total = (total + now) % MOD;
  }
  cout << total << '\n';
}