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 N = 3000;
std::vector<pair<long long, long long> > v[N];
bool visited[N];
long long color[N];
bool flag;
void dfs(long long n) {
  visited[n] = 1;
  for (auto i : v[n]) {
    if (visited[i.first] == 0)
      color[i.first] = color[n] ^ i.second, dfs(i.first);
    else {
      if (color[i.first] != (color[n] ^ i.second)) {
        flag = 0;
      }
    }
  }
}
long long mod_expo(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & (long long)1) ans = (ans * a) % c;
    a = (a * a) % c;
    b = b >> 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long n = s.size();
  reverse(s.begin(), s.end());
  long long ans = 0;
  for (long long k = 1; k < n; k++) {
    long long index = n + 2;
    for (long long i = 0; i < (index + k); i++)
      v[i].clear(), visited[i] = 0, color[i] = 0;
    for (long long i = 0; i < n / 2; i++) {
      v[i].push_back(make_pair(n - 1 - i, 0));
      v[n - 1 - i].push_back(make_pair(i, 0));
    }
    for (long long i = 0; i < k / 2; i++) {
      v[index + i].push_back(make_pair(index + k - 1 - i, 0));
      v[index + k - 1 - i].push_back(make_pair(index + i, 0));
    }
    for (long long i = 0; i < k; i++) {
      if (s[i] == '0') {
        v[i].push_back(make_pair(index + i, 0));
        v[index + i].push_back(make_pair(i, 0));
      } else if (s[i] == '1') {
        v[i].push_back(make_pair(index + i, 1));
        v[index + i].push_back(make_pair(i, 1));
      }
    }
    for (long long i = k; i < n; i++) {
      if (s[i] == '0') {
        v[i].push_back(make_pair(n + 1, 0));
        v[n + 1].push_back(make_pair(i, 0));
      } else if (s[i] == '1') {
        v[i].push_back(make_pair(n, 0));
        v[n].push_back(make_pair(i, 0));
      }
    }
    v[index + k - 1].push_back(make_pair(n, 0));
    v[n].push_back(make_pair(index + k - 1, 0));
    flag = 1;
    memset(visited, 0, sizeof(visited));
    visited[n] = visited[n + 1] = 1;
    color[n] = 1;
    color[n + 1] = 0;
    dfs(n);
    dfs(n + 1);
    long long count = 0;
    for (long long i = 0; i < (index + k); i++) {
      if (visited[i] == 0) {
        dfs(i);
        count++;
      }
    }
    if (flag) ans = (ans + mod_expo(2, count, 998244353)) % 998244353;
  }
  cout << ans;
  return 0;
}