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 UNDEFINED = -2;
const int WILDCARD = -1000;
string s;
int n, astart;
bool ok = true;
int idx[2][1005][2], a[1005];
int par[4005], cnt = 0;
bool good[4005];
int final[4005];
int getMirror(int row, int pos) {
  if (row == 1) {
    return n - 1 - pos;
  }
  return (n - 1) - (pos - astart);
}
int root(int x) {
  if (x != par[x]) {
    par[x] = root(par[x]);
  }
  return par[x];
}
void merge(int x, int y) {
  x = root(x);
  y = root(y);
  if (x != y) {
    par[y] = x;
  }
}
long long get(int start) {
  astart = start;
  cnt = 0;
  for (int i = start; i < n; i++) {
    idx[0][i][0] = cnt++;
    idx[0][i][1] = cnt++;
  }
  for (int i = 0; i < n; i++) {
    idx[1][i][0] = cnt++;
    idx[1][i][1] = cnt++;
  }
  for (int i = 0; i < cnt; i++) {
    par[i] = i;
  }
  for (int x = start; x < n; x++) {
    int y = getMirror(0, x);
    merge(idx[0][x][0], idx[0][y][0]);
    merge(idx[0][x][1], idx[0][y][1]);
  }
  for (int x = 0; x < n; x++) {
    int y = getMirror(1, x);
    merge(idx[1][x][0], idx[1][y][0]);
    merge(idx[1][x][1], idx[1][y][1]);
  }
  for (int i = start; i < n; i++)
    if (a[i] != WILDCARD) {
      merge(idx[0][i][0], idx[1][i][a[i]]);
      merge(idx[0][i][1], idx[1][i][a[i] ^ 1]);
    }
  memset(good, true, sizeof good);
  for (int i = 0; i < start; i++)
    if (a[i] != WILDCARD) {
      int px = root(idx[1][i][a[i] ^ 1]);
      good[px] = false;
    }
  int px = root(idx[0][start][0]);
  good[px] = false;
  for (int i = 0; i < cnt; i++)
    if (root(i) == root(i ^ 1)) {
      return 0;
    }
  for (int i = 0; i < cnt; i++) {
    final[i] = UNDEFINED;
  }
  long long ways = 1;
  for (int i = 0; i < cnt; i += 2) {
    int px = root(i), py = root(i + 1);
    if (final[px] != UNDEFINED && final[py] != UNDEFINED) {
      continue;
    }
    if (!good[px] && !good[py]) {
      return 0;
    }
    if (good[px] != good[py]) {
      final[px] = 0;
      final[py] = 0;
      continue;
    }
    ways *= 2;
    ways %= 998244353;
    final[px] = 0;
    final[py] = 0;
  }
  return ways;
}
long long solve() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++)
    if (s[i] == '?') {
      a[i] = WILDCARD;
    } else {
      a[i] = s[i] - '0';
    }
  if (a[n - 1] == 1) {
    return 0;
  }
  long long ans = 0;
  for (int start = 1; start < n; start++) {
    ans += get(start);
    ans %= 998244353;
  }
  return ans;
}
int main() {
  printf("%lld\n", solve());
  return 0;
}