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;
char s[1005];
int n, k;
const int mod = 998244353;
int c[1005 << 1];
int idx(int id, int p) { return n * (id - 1) + p; }
bool give(int id, int cc) {
  if (c[id] >= 0) {
    if (c[id] != cc) return 0;
    return 1;
  }
  c[id] = cc;
  int r = 1 + (id > n);
  int t = id > n ? id - n : id;
  if (r == 1) {
    if (!give(idx(1, n + 1 - t), cc)) return 0;
    if (t <= k) {
      if (s[n + 1 - t] != '?') {
        if (!give(idx(2, t), cc ^ (s[n + 1 - t] - '0'))) return 0;
      }
    }
  } else {
    if (!give(idx(2, k + 1 - t), cc)) return 0;
    if (t <= k) {
      if (s[n + 1 - t] != '?') {
        if (!give(idx(1, t), cc ^ (s[n + 1 - t] - '0'))) return 0;
      }
    }
  }
  return 1;
}
int solve(int K) {
  k = K;
  int nn = n >> 1, kk = k >> 1;
  int tot = idx(2, k);
  for (int i = 1; i <= tot; i++) c[i] = -1;
  for (int i = k + 1; i <= n; i++)
    if (s[n + 1 - i] != '?') {
      if (!give(idx(1, i), s[n + 1 - i] - '0')) return 0;
    }
  if (!give(idx(2, k), 1)) return 0;
  int ans = 1;
  for (int i = 1; i <= tot; i++)
    if (c[i] < 0) {
      if (!give(i, 1)) return 0;
      ans <<= 1;
      if (ans >= mod) ans -= mod;
    }
  return ans;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  if (s[n] == '1') {
    puts("0");
    return 0;
  }
  s[n] = '0';
  int ans = 0;
  for (int i = 1; i < n; i++) {
    ans += solve(i);
    if (ans >= mod) ans -= mod;
  }
  printf("%d\n", ans);
  return 0;
}