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 maxn = 2005, mod = 998244353;
vector<pair<int, int> > G[maxn];
int val[maxn], vis[maxn];
char s[maxn];
long long p[maxn];
void add(long long &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
void Add(int u, int v, int w) { G[u].push_back(make_pair(v, w)); }
int dfs(int u) {
  vis[u] = 1;
  int flag = 1;
  for (auto tmp : G[u]) {
    int v = tmp.first;
    int w = tmp.second;
    if (vis[v]) {
      if (val[v] == val[u] && w) return 0;
      if (val[v] != val[u] && !w) return 0;
      continue;
    }
    if (w)
      val[v] = 3 - val[u];
    else
      val[v] = val[u];
    flag &= dfs(v);
  }
  return flag;
}
int main() {
  cin >> s + 1;
  int n = strlen(s + 1);
  long long ans = 0;
  p[0] = 1;
  for (int i = 1; i <= n * 2; i++) p[i] = p[i - 1] * 2 % mod;
  for (int i = 1; i < n; i++) {
    int S = n + i + 1;
    val[S] = 1;
    Add(S, 1, 0);
    Add(S, n + 1, 0);
    for (int j = 1; j <= n; j++) Add(j, n + 1 - j, 0);
    for (int j = 1; j <= i; j++) Add(n + j, n + i + 1 - j, 0);
    for (int j = 2; j + i <= n; j++)
      if (s[j] == '0')
        Add(S, j, 1);
      else if (s[j] == '1')
        Add(S, j, 0);
    for (int j = 1; j <= i; j++) {
      int k = n - i + j;
      if (s[k] == '0')
        Add(j + n, k, 0), Add(k, j + n, 0);
      else if (s[k] == '1')
        Add(j + n, k, 1), Add(k, j + n, 1);
    }
    int res = 0, flag = dfs(S);
    for (int j = 1; j <= n + i && flag; j++)
      if (!vis[j]) {
        val[j] = 1, res++, flag &= dfs(j);
      }
    if (flag) add(ans, p[res]);
    for (int j = 1; j <= S; j++) G[j].clear(), val[j] = vis[j] = 0;
  }
  cout << ans;
}