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 sum(int x, int y) { return x + y < MOD ? x + y : x + y - MOD; }
int mul(int x, int y) { return x * 1LL * y % MOD; }
const int N = 1007;
int n;
char s[N];
vector<pair<int, int>> g[2 * N];
int color[2 * N];
int dfs(int v, int c) {
  color[v] = c + 1;
  int res = 1;
  for (auto e : g[v]) {
    int nxt_c = c ^ e.second;
    if (color[e.first] == 0) {
      res *= dfs(e.first, nxt_c);
    } else if (color[e.first] != nxt_c + 1) {
      res = 0;
    }
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string inp_s;
  cin >> inp_s;
  n = (int)inp_s.size();
  for (int i = 0; i < n; ++i) {
    s[i] = inp_s[i];
  }
  int ans = 0;
  for (int len_a = 1; len_a < n; ++len_a) {
    for (int v = 0; v < 2 * n; ++v) {
      g[v].clear();
    }
    fill(color, color + 2 * n, 0);
    for (int i = 0; i < n; ++i) {
      if (s[i] == '0') {
        g[2 * i].push_back({2 * i + 1, 0});
        g[2 * i + 1].push_back({2 * i, 0});
      } else if (s[i] == '1') {
        g[2 * i].push_back({2 * i + 1, 1});
        g[2 * i + 1].push_back({2 * i, 1});
      }
      g[2 * i].push_back({2 * (n - 1 - i), 0});
      if (i >= n - len_a) {
        g[2 * i + 1].push_back({2 * (n - 1 - (i - (n - len_a))) + 1, 0});
      }
    }
    int cur = dfs(0, 1);
    if (color[2 * (n - len_a) + 1] == 1) {
      cur = 0;
    }
    cur *= dfs(2 * (n - len_a) + 1, 1);
    for (int i = 0; i < n - len_a; ++i) {
      if (color[2 * i] == 0) {
        if (s[i] == '0') {
          cur *= dfs(2 * i, 0);
        } else if (s[i] == '1') {
          cur *= dfs(2 * i, 1);
        }
      } else {
        if (s[i] == '0' && color[2 * i] != 1) {
          cur = 0;
        } else if (s[i] == '1' && color[2 * i] != 2) {
          cur = 0;
        }
      }
      if (color[2 * i + 1] == 0) {
        cur *= dfs(2 * i + 1, 0);
      } else if (color[2 * i + 1] != 1) {
        cur = 0;
      }
    }
    for (int v = 0; v < 2 * n; ++v) {
      if (color[v] == 0) {
        cur = mul(cur, 2 * dfs(v, 0));
      }
    }
    ans = sum(ans, cur);
  }
  cout << ans << '\n';
  return 0;
}