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;
int fa[2013];
bool r[2013];
int b[2013];
int find(int x) {
  if (fa[x] == x) return fa[x];
  int ro = find(fa[x]);
  r[x] ^= r[fa[x]];
  return fa[x] = ro;
}
bool uni(int x, int y, bool w) {
  int r1 = find(x), r2 = find(y);
  if (r1 == r2) return ((r[x] ^ r[y]) == w);
  fa[r1] = r2;
  r[r1] = w ^ r[x] ^ r[y];
  return 1;
}
string s;
void init() {
  for (int i = 0; i < 2013; i++) {
    fa[i] = i, b[i] = -1;
    r[i] = 0;
  }
}
long long cal(int s1, int s2) {
  for (int i = 0; i < s1 / 2; i++) {
    if (uni(i, s1 - 1 - i, 0) == 0) return 0;
  }
  for (int i = 0; i < s2 / 2; i++) {
    if (uni(s1 + i, s1 + s2 - 1 - i, 0) == 0) return 0;
  }
  for (int i = 0; i < s1; i++) {
    if (s[i] == '?') continue;
    if (i < s1 - s2) {
      b[i] = s[i] - '0';
      continue;
    }
    if (uni(i, s1 + i - (s1 - s2), s[i] - '0') == 0) return 0;
  }
  long long res = 1;
  b[s1] = 1;
  for (int i = 0; i < s1 + s2; i++) {
    int ro = find(i);
    if (ro != i) {
      if (b[i] == -1) continue;
      if (b[ro] != -1 && r[i] != (b[ro] ^ b[i])) return 0;
      b[ro] = r[i] ^ b[i];
      continue;
    }
  }
  for (int i = 0; i < s1 + s2; i++) {
    int ro = find(i);
    if (ro != i || b[i] != -1) continue;
    res = res * 2 % 998244353;
  }
  return res;
}
int main() {
  cin >> s;
  int si = (int)s.size();
  long long ans = 0;
  for (int len = 1; len < si; len++) {
    init();
    int res = cal(si, len);
    ans = (ans + res) % 998244353;
  }
  cout << ans;
  return 0;
}