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 N = 2020, MOD = 998244353;
int sum(int a, int b) {
  a += b;
  if (a < 0)
    a += MOD;
  else if (a >= MOD)
    a -= MOD;
  return a;
}
int mul(int a, int b) { return 1LL * a * b % MOD; }
int n, ans;
bool mark[N], x[N];
string s;
vector<pair<int, bool> > nei[N];
bool dfs(int v) {
  mark[v] = true;
  for (pair<int, bool> e : nei[v]) {
    if (mark[e.first] == false) {
      x[e.first] = x[v] ^ e.second;
      if (dfs(e.first) == false) return false;
    } else if (x[e.first] != x[v] ^ e.second)
      return false;
  }
  return true;
}
int solve(int dex) {
  for (int i = 0; i < N; i++) nei[i].clear();
  for (int i = 0; i < n; i++) nei[i].push_back(pair<int, bool>(n - i - 1, 0));
  for (int i = dex; i < n; i++)
    nei[n + i].push_back(pair<int, bool>(n + n - 1 - i + dex, 0));
  for (int i = 0; i < n; i++)
    if (s[i] != '?')
      nei[i].push_back(pair<int, bool>(i + n, s[i] - '0')),
          nei[i + n].push_back(pair<int, bool>(i, s[i] - '0'));
  int res = 1;
  memset(mark, false, sizeof mark);
  x[0] = 1;
  if (dfs(0) == false) return 0;
  if (mark[n + dex] && x[n + dex] == 0)
    return 0;
  else if (mark[n + dex] == false) {
    x[n + dex] = 1;
    if (dfs(n + dex) == false) return false;
  }
  for (int i = n; i < n + dex; i++)
    if (mark[i] && x[i])
      return 0;
    else if (mark[i] == false) {
      x[i] = 0;
      if (dfs(i) == false) return 0;
    }
  for (int i = 0; i < 2 * n; i++)
    if (mark[i] == false) {
      if (dfs(i))
        res = mul(res, 2);
      else
        return 0;
    }
  return res;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> s;
  n = s.length();
  for (int i = 1; i < n; i++) ans = sum(ans, solve(i));
  cout << ans;
  return 0;
}