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 maxn = 1e4 + 5;
const long long inf = 0x3f3f3f3f3f;
const long long mod = 998244353;
string str;
int s[maxn];
long long ans, n;
struct node {
  int to, val, next;
} e[maxn];
int cnt, head[maxn], vis[maxn], col[maxn];
void add(int u, int v, int val) {
  e[++cnt] = (node){v, val, head[u]};
  head[u] = cnt;
  return;
}
void dfs(long long u, long long 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 % mod;
    n >>= 1;
    x = x * x % mod;
  }
  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 = n + m; 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 < n * 2; i++) {
    if (!vis[i]) dfs(i, 0), now++;
  }
  bool flag = true;
  for (int i = 0; i < n * 2; 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)) % mod;
  return;
}
int main() {
  cin >> str;
  for (int i = 0; i < str.size(); 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 % mod + mod) % mod;
  return 0;
}