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 N, C, T;
string s;
int val[2005];
int vis[2005];
int done[2005];
long long MOD = 998244353;
long long mult(long long a, long long b) { return a * b % MOD; }
long long add(long long a, long long b) { return (a + b) % MOD; }
bool dfs(int n, int l) {
  vis[n] = C;
  done[n] = T;
  bool ret = 1;
  if (n > N) {
    if (n == N + l && val[n] == 0) {
      ret = 0;
    }
    if (vis[N + l - (n - N) + 1] != C) {
      val[N + l - (n - N) + 1] = val[n];
      ret &= dfs(N + l - (n - N) + 1, l);
    }
    if (s[N - (n - N)] != '?' && vis[2 * N - n + 1] != C) {
      val[2 * N - n + 1] = val[n] ^ (s[N - (n - N)] - '0');
      ret &= dfs(2 * N - n + 1, l);
    }
  } else {
    if (n <= N - l) {
      if (s[n - 1] != '?' && s[n - 1] - '0' != val[n]) {
        ret = 0;
      }
    } else if (s[n - 1] != '?' && vis[2 * N - n + 1] != C) {
      val[2 * N - n + 1] = val[n] ^ (s[n - 1] - '0');
      ret &= dfs(2 * N - n + 1, l);
    }
    if (vis[N - n + 1] != C) {
      val[N - n + 1] = val[n];
      ret &= dfs(N - n + 1, l);
    }
  }
  return ret;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  N = s.size();
  long long ans = 0;
  for (int i = 1; i < N; i++) {
    long long tot = 1;
    T++;
    for (int j = 1; j <= N + i; j++) {
      if (done[j] != T) {
        C++;
        int cnt = 0;
        val[j] = 0;
        cnt += dfs(j, i);
        ++C;
        val[j] = 1;
        cnt += dfs(j, i);
        tot = mult(tot, cnt);
      }
    }
    ans = add(ans, tot);
  }
  cout << ans << "\n";
}