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 MOD = 998244353;
string s;
int n, ans;
int T, A[1010], B[1010], cnt, head[2010], nxt[100010], dis[100010], id;
bool w[100010];
void link(int a, int b, int c) {
  nxt[++id] = head[a], head[a] = id, dis[id] = b, w[id] = c;
  nxt[++id] = head[b], head[b] = id, dis[id] = a, w[id] = c;
}
int power[2010];
bool vis[2010], col[2010];
bool dfs(int x) {
  for (int i = head[x]; i; i = nxt[i]) {
    if (!vis[dis[i]]) {
      vis[dis[i]] = 1;
      col[dis[i]] = col[x] ^ w[i];
      if (dfs(dis[i])) return 1;
    } else if (col[dis[i]] ^ col[x] ^ w[i])
      return 1;
  }
  return 0;
}
int main() {
  cin >> s;
  n = s.size();
  s = " " + s;
  power[0] = 1;
  for (int i = 1; i <= 2000; ++i) power[i] = power[i - 1] * 2 % MOD;
  for (int S = 2; S <= n; ++S) {
    memset(head, 0, sizeof(head));
    id = cnt = 0;
    T = cnt++;
    for (int i = S; i <= n; ++i) A[i] = cnt++;
    for (int i = 1; i <= n; ++i) B[i] = cnt++;
    link(B[1], T, 1);
    link(A[S], T, 1);
    for (int i = S; i <= n; ++i) {
      if (s[i] == '0')
        link(A[i], B[i], 0);
      else if (s[i] == '1')
        link(A[i], B[i], 1);
    }
    for (int i = 1; i < S; ++i) {
      if (s[i] == '0')
        link(B[i], T, 0);
      else if (s[i] == '1')
        link(B[i], T, 1);
    }
    for (int i = S, j = n; i < j; ++i, --j) link(A[i], A[j], 0);
    for (int i = 1, j = n; i < j; ++i, --j) link(B[i], B[j], 0);
    memset(vis, 0, sizeof(vis));
    int C = 0;
    for (int i = 0; i < cnt; ++i)
      if (!vis[i]) {
        ++C;
        if (dfs(i)) {
          C = -1;
          break;
        }
      }
    if (~C) ans = (ans + power[C - 1]) % MOD;
  }
  printf("%d\n", ans);
  return 0;
}