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;
long long ans, n, vis[2010];
char s[1010];
vector<int> adj[2010][2];
void clean() {
  for (int i = 0; i < 2010; i++) {
    adj[i][0].clear();
    adj[i][1].clear();
    vis[i] = -1;
  }
}
void add(int a, int b, int c) {
  adj[a][c].push_back(b);
  adj[b][c].push_back(a);
}
int dfs(int no, int cor = 0) {
  if (vis[no] == -1)
    vis[no] = cor;
  else if (vis[no] != cor)
    return 0;
  else
    return 1;
  int flag = 1;
  for (int c = 0; c <= 1; c++)
    for (int v : adj[no][c]) flag &= dfs(v, cor ^ c);
  return flag;
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  reverse(s, s + n);
  for (int k = 1; k < n; k++) {
    clean();
    for (int l = 0, r = n - 1; l < r; l++, r--) add(l, r, 0);
    for (int l = 0, r = k - 1; l < r; l++, r--) add(1000 + l, 1000 + r, 0);
    add(1000 + k - 1, 2000, 1);
    for (int i = 0; i < n; i++) {
      if (s[i] != '?') add(i, 1000 + i, s[i] == '1');
      if (i >= k) add(1000 + i, 2000, 0);
    }
    long long mult = 1;
    if (dfs(2000) == 0) mult = 0;
    for (int i = 0; mult && i < 2010; i++) {
      if ((i < n || (i >= 1000 && i < 1000 + k)) && vis[i] == -1) {
        if (dfs(i) == 0) mult = 0;
        mult = mult * 2LL % 998244353;
      }
    }
    ans += mult;
    if (ans >= 998244353) ans -= 998244353;
  }
  printf("%lld\n", ans);
  return 0;
}