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 long long int modulo = 998244353;
void add(long long int &a, long long int b) { a = (a + b) % modulo; }
const int limit = 1005;
int n;
int v[limit];
int seen[limit];
long long int expo[limit];
long long int options(int pos, int len, int val, int nummarks);
long long int optionsdown(int pos, int len, int val, int nummarks) {
  if (len % 2 == 1 and pos == (len + 1) / 2) return expo[nummarks];
  if (v[pos] == -1) nummarks++;
  int nextval = v[pos] == -1 ? 1 : (val ^ v[pos]);
  return options(n - pos + 1, len, nextval, nummarks);
}
long long int options(int pos, int len, int val, int nummarks) {
  seen[pos] = 1;
  if (n % 2 == 1 and pos == (n + 1) / 2) return expo[nummarks];
  if (v[pos] == -1) nummarks++;
  if (pos > len) {
    if (nummarks) return expo[nummarks - 1];
    if (v[pos] != val) return 0;
    return 1;
  }
  int nextval = v[pos] == -1 ? 1 : (val ^ v[pos]);
  return optionsdown(len - pos + 1, len, nextval, nummarks);
}
long long int compute(int len) {
  for (int i = 1; i <= n; i++) seen[i] = 0;
  long long int sol = 1;
  for (int i = n; i > len; i--) {
    if (not seen[i]) {
      seen[i] = 1;
      int val, nummarks;
      if (v[i] == -1) {
        nummarks = 1;
        val = 1;
      } else {
        nummarks = 0;
        val = v[i];
      }
      long long int o = options(n - i + 1, len, val, nummarks);
      if (o == 0) return 0;
      sol = (sol * o) % modulo;
    }
  }
  return sol;
}
int main() {
  long long int sol = 0;
  expo[0] = 1;
  for (int i = 1; i < limit; i++) expo[i] = expo[i - 1] * 2 % modulo;
  string s;
  cin >> s;
  n = int(s.size());
  s = " " + s;
  for (int i = 1; i <= n; i++) {
    char c = s[i];
    if (c == '?')
      v[i] = -1;
    else
      v[i] = c - '0';
  }
  reverse(v + 1, v + (n + 1));
  if (v[1] == 1) {
    cout << 0 << endl;
    exit(0);
  }
  v[1] = 0;
  for (int len = 1; len < n; len++) add(sol, compute(len));
  cout << sol << endl;
}