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;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  long long m = (long long)s.size();
  long long c = 0;
  for (long long k = 1; k < m; k++) {
    long long last_vertex = 0;
    vector<vector<long long>> adj;
    auto inverse_edge = [&](long long x, long long y) {
      adj.resize(max(adj.size(), (size_t)max(x, y) + 1));
      adj[x].push_back(y);
      adj[y].push_back(x);
    };
    auto equal_edge = [&](long long x, long long y) {
      long long z = last_vertex++;
      inverse_edge(x, z);
      inverse_edge(y, z);
    };
    auto char_edge = [&](long long x, long long y, char z) {
      if (z == '0') {
        equal_edge(x, y);
      }
      if (z == '1') {
        inverse_edge(x, y);
      }
    };
    long long zero_vertex = last_vertex++;
    long long one_vertex = last_vertex++;
    inverse_edge(zero_vertex, one_vertex);
    vector<long long> a_vertexes((size_t)k);
    for (long long &i : a_vertexes) {
      i = last_vertex++;
    }
    vector<long long> b_vertexes((size_t)m);
    for (long long &i : b_vertexes) {
      i = last_vertex++;
    }
    equal_edge(a_vertexes[0], one_vertex);
    equal_edge(b_vertexes[0], one_vertex);
    for (long long i = 0; i < k; i++) {
      equal_edge(a_vertexes[i], a_vertexes[k - i - 1]);
    }
    for (long long i = 0; i < m; i++) {
      equal_edge(b_vertexes[i], b_vertexes[m - i - 1]);
    }
    for (long long i = 0; i < m; i++) {
      if (i - m + k < 0) {
        char_edge(b_vertexes[i], zero_vertex, s[i]);
      } else {
        char_edge(b_vertexes[i], a_vertexes[i - m + k], s[i]);
      }
    }
    vector<long long> colors((size_t)last_vertex, -1);
    function<bool(long long, long long)> visit = [&](long long i, long long x) {
      if (colors[i] == -1) {
        colors[i] = x;
        for (long long j : adj[i]) {
          if (!visit(j, 1 - x)) {
            return false;
          }
        }
      }
      return colors[i] == x;
    };
    long long a = 1;
    bool f = false;
    for (long long i = 0; i < last_vertex; i++) {
      if (colors[i] == -1) {
        if (visit(i, 0)) {
          if (f) {
            a *= 2;
            a %= 998244353;
          }
          f = true;
        } else {
          a = 0;
          break;
        }
      }
    }
    c += a;
    c %= 998244353;
  }
  cout << c << endl;
  return 0;
}