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 long long mod = 998244353;
char s[1005];
int N;
long long p2[2005];
vector<pair<int, int> > G[2005];
int col[2005];
bool dfs(int cur, int c) {
  if (col[cur] != -1) return (col[cur] == c);
  col[cur] = c;
  for (int i = 0; i < (int)G[cur].size(); i++) {
    if (!dfs(G[cur][i].first, c ^ G[cur][i].second)) return false;
  }
  return true;
}
int main(int argc, char** argv) {
  scanf("%s", s);
  N = strlen(s);
  p2[0] = 1;
  for (int i = 1; i <= 2 * N; i++) p2[i] = (p2[i - 1] + p2[i - 1]) % mod;
  long long ans = 0;
  for (int K = 1; K < N; K++) {
    for (int i = 0; i < 2 * N; i++) G[i].clear();
    for (int i = 0; i < N; i++) {
      if (i != N - i - 1) G[i].push_back(pair<int, int>(N - i - 1, 0));
    }
    for (int i = 0; i < K; i++) {
      if (i != K - i - 1)
        G[2 * N - K + i].push_back(pair<int, int>(2 * N - i - 1, 0));
    }
    for (int i = 0; i < N; i++) {
      if (s[i] != '?') {
        G[i].push_back(pair<int, int>(i + N, s[i] - '0'));
        G[i + N].push_back(pair<int, int>(i, s[i] - '0'));
      }
    }
    memset(col, -1, sizeof(col));
    bool flag = dfs(0, 1);
    for (int i = 1; i < N - K; i++) flag &= dfs(i + N, 0);
    flag &= dfs(2 * N - K, 1);
    if (!flag) continue;
    int cnt = 0;
    for (int i = 1; i < 2 * N; i++) {
      if (col[i] == -1) {
        cnt++;
        dfs(i, 0);
      }
    }
    ans = (ans + p2[cnt]) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}