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;
void dfs(int u, vector<vector<int>> &g, vector<vector<int>> &gg,
         vector<int> &color) {
  for (auto v : g[u]) {
    if (color[v] == -1) {
      color[v] = (color[u] + 1) % 2;
      dfs(v, g, gg, color);
    }
  }
  for (auto v : gg[u]) {
    if (color[v] == -1) {
      color[v] = color[u];
      dfs(v, g, gg, color);
    }
  }
}
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans *= a;
    a *= a;
    a %= mod;
    ans %= mod;
    b /= 2;
  }
  return ans;
}
int main() {
  string s;
  cin >> s;
  int n = s.size();
  long long ans = 0;
  for (int k = 0; k < n; k++) {
    vector<vector<int>> g(n * 2), gg(2 * n);
    for (int i = 0; i < n; i++) {
      gg[i].push_back(n - i - 1);
      gg[n - i - 1].push_back(i);
    }
    for (int i = 0; i <= k; i++) {
      gg[2 * n - k - 1 + i].push_back(2 * n - 1 - i);
      gg[2 * n - 1 - i].push_back(2 * n - k - 1 + i);
    }
    for (int i = 0; i < n; i++) {
      if (s[i] == '0') {
        gg[i].push_back(n + i);
        gg[n + i].push_back(i);
      }
      if (s[i] == '1') {
        g[i].push_back(n + i);
        g[n + i].push_back(i);
      }
    }
    gg[0].push_back(2 * n - k - 1);
    gg[n * 2 - k - 1].push_back(0);
    for (int i = n; i < 2 * n - k - 1; i++) {
      g[i].push_back(0);
      g[0].push_back(i);
    }
    vector<int> color(n * 2, -1);
    int num = 0;
    for (int i = 0; i < n * 2; i++) {
      if (color[i] == -1) {
        color[i] = 0;
        num++;
        dfs(i, g, gg, color);
      }
    }
    bool flag = true;
    for (int i = 0; i < n * 2; i++) {
      for (auto v : g[i]) {
        if (color[v] == color[i]) flag = false;
      }
      for (auto v : gg[i])
        if (color[i] != color[v]) flag = false;
    }
    if (flag) ans += poww(2, num - 1);
    ans %= mod;
  }
  cout << ans;
  cin >> ans;
}