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 MOD = 998244353;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  string t = "";
  for (int i = 0; i < n; i++) t += '0';
  t[n - 1] = '1';
  vector<int> pw2(2 * n + 1);
  pw2[0] = 1;
  for (int i = 1; i <= 2 * n; i++) {
    pw2[i] = pw2[i - 1] * 2;
    if (pw2[i] >= MOD) pw2[i] -= MOD;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    t[i] = '0';
    vector<vector<pair<int, int>>> G(2 * n);
    for (int l = i, r = n - 1; l < r; l++, r--) {
      G[l].emplace_back(r, 0);
      G[r].emplace_back(l, 0);
    }
    for (int l = n, r = 2 * n - 1; l < r; l++, r--) {
      G[l].emplace_back(r, 0);
      G[r].emplace_back(l, 0);
    }
    for (int j = 0; j < n; j++) {
      if (s[j] == '?') continue;
      G[j].emplace_back(j + n, s[j] - '0');
      G[j + n].emplace_back(j, s[j] - '0');
    }
    vector<int> vis(2 * n, -1);
    queue<int> q;
    for (int j = 0; j < i; j++) {
      vis[j] = 0;
      q.push(j);
    }
    vis[i] = vis[n - 1] = vis[n] = vis[2 * n - 1] = 1;
    q.push(i);
    q.push(n - 1);
    q.push(n);
    q.push(2 * n - 1);
    int ok = 1;
    while (!q.empty()) {
      int nd = q.front();
      q.pop();
      for (pair<int, int> edge : G[nd]) {
        if (vis[edge.first] != -1) {
          if (vis[edge.first] != (vis[nd] ^ edge.second)) {
            ok = 0;
            break;
          }
        } else {
          vis[edge.first] = vis[nd] ^ edge.second;
          q.push(edge.first);
        }
      }
      if (!ok) break;
    }
    int comp = 0;
    for (int j = 0; j < 2 * n; j++) {
      if (vis[j] == -1) {
        q.push(j);
        vis[j] = 1;
        while (!q.empty()) {
          int nd = q.front();
          q.pop();
          for (pair<int, int> edge : G[nd]) {
            if (vis[edge.first] != -1) {
              if (vis[edge.first] != (vis[nd] ^ edge.second)) {
                ok = 0;
                break;
              }
            } else {
              vis[edge.first] = vis[nd] ^ edge.second;
              q.push(edge.first);
            }
          }
        }
        comp++;
      }
    }
    ans += ok * pw2[comp];
    if (ans >= MOD) ans -= MOD;
  }
  cout << ans << '\n';
  return 0;
}