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 mod = 998244353;
int n, l;
string s;
vector<long long> u;
long long syma(int i) { return (2 * n - l - 1 - i); }
long long symb(int i) { return (n - 1 - i); }
long long f(int i) {
  u[i] = 1;
  int c = 0;
  vector<vector<long long> > dp(2, vector<long long>(2, 0));
  if (s[i] == '0' || s[i] == '?') dp[0][0] = 1;
  if (s[i] == '1' || s[i] == '?') dp[0][1] = 1;
  while (true) {
    if (c == 0)
      i = symb(i);
    else {
      if (i < n - l || u[syma(i)])
        return (dp[0][0] + dp[0][1] + dp[1][0] + dp[1][1]) % mod;
      i = syma(i);
    }
    c ^= 1;
    u[i] = 1;
    vector<vector<long long> > dd(2, vector<long long>(2, 0));
    for (int a = 0; a < 2; ++a) {
      if (i < n - l && a == 1) continue;
      if (i == n - l && a == 0) continue;
      for (int b = 0; b < 2; ++b) {
        if (s[i] != '?' && s[i] - '0' != (a + b) % 2) continue;
        if (c == 1)
          dd[a][b] += dp[0][b] + dp[1][b];
        else
          dd[a][b] += dp[a][0] + dp[a][1];
        dd[a][b] %= mod;
      }
    }
    swap(dp, dd);
  }
}
long long num() {
  u.assign(n, 0);
  long long res = 1;
  for (int i = 0; i < n; ++i) {
    if (u[i]) continue;
    res = (res * f(i)) % mod;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  n = s.length();
  long long res = 0;
  for (l = 1; l < n; ++l) {
    res += num();
    if (res >= mod) res -= mod;
  }
  cout << res;
  return 0;
}