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 = 1e4 + 10;
int n;
long long ans;
string str;
int s[N];
struct node {
  int to;
  int val;
  int next;
} e[N];
int cnt;
int head[N];
bool vis[N];
int col[N];
void add(int u, int v, int val) {
  e[++cnt] = (node){v, val, head[u]};
  head[u] = cnt;
  return;
}
void dfs(int u, int c) {
  col[u] = c;
  vis[u] = 1;
  for (int i = head[u]; i != -1; i = e[i].next)
    if (!vis[e[i].to]) dfs(e[i].to, (col[u] + e[i].val) % 2);
  return;
}
long long qpow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % 998244353;
    n >>= 1;
    x = x * x % 998244353;
  }
  return res;
}
void solve(int n, int m) {
  cnt = 0;
  for (int i = 0; i < 2 * n; i++) head[i] = -1, vis[i] = 0;
  add(0, n, 0);
  add(n, 0, 0);
  for (int i = 0; i < n; i++) add(i, n - i - 1, 0);
  for (int i = 0; i < m; i++) add(n + i, n + m - i - 1, 0);
  for (int i = m + n; i < 2 * n; i++) add(i, 0, 1), add(0, i, 1);
  for (int i = 0; i < n; i++)
    if (s[i] == 1) {
      add(i, n + i, 1), add(n + i, i, 1);
    } else if (s[i] == 0) {
      add(i, n + i, 0), add(n + i, i, 0);
    }
  int now = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (!vis[i]) {
      dfs(i, 0);
      now++;
    }
  }
  bool flag = 1;
  for (int i = 0; i < 2 * n; i++) {
    for (int j = head[i]; j != -1; j = e[j].next) {
      if ((col[i] + col[e[j].to]) % 2 != e[j].val) flag = 0;
    }
  }
  if (flag) ans = (ans + qpow(2LL, 1LL * now - 1)) % 998244353;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> str;
  for (int i = 0; str[i]; i++) s[i] = str[i] == '?' ? -1 : str[i] - '0';
  n = str.size();
  reverse(s, s + n);
  ans = 0;
  for (int i = 1; i < n; i++) {
    solve(n, i);
  }
  cout << (ans % 998244353 + 998244353) % 998244353 << endl;
  return 0;
}