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;
string s;
int n;
long long ans = 0;
long long mod = 998244353;
vector<pair<int, int> > g[2021];
void add_edge(int u, int v, int w) {
  g[u].push_back(pair<int, int>(v, w));
  g[v].push_back(pair<int, int>(u, w));
}
int col[2020];
bool dfs(int u, int c) {
  if (col[u] != -1) return col[u] == c;
  col[u] = c;
  for (auto x : g[u]) {
    if (!dfs(x.first, x.second ^ col[u])) return false;
  }
  return true;
}
void solve(int m) {
  for (int i = 1; i <= m + n + 2; i++) col[i] = -1, g[i].clear();
  int pos0 = m + n + 1;
  int pos1 = m + n + 2;
  for (int i = 1; i <= n / 2; i++) add_edge(i, n - i + 1, 0);
  for (int i = 1; i <= m / 2; i++) add_edge(i + n, n + m - i + 1, 0);
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '?') continue;
    int pos = m - n + i;
    if (pos <= 0) {
      if (s[i - 1] == '1') add_edge(i, pos1, 0);
      if (s[i - 1] == '0') add_edge(i, pos0, 0);
      continue;
    }
    if (s[i - 1] == '0')
      add_edge(i, pos + n, 0);
    else if (s[i - 1] == '1')
      add_edge(i, pos + n, 1);
  }
  add_edge(pos0, pos1, 1);
  int cnt = 0;
  for (int i = 1; i <= n + m + 2; i++) {
    if (col[i] == -1) {
      cnt++;
      if (!dfs(i, 0)) return;
    }
  }
  long long addon = 1;
  for (int i = 1; i <= cnt - 1; i++) {
    addon <<= 1;
    addon %= mod;
  }
  ans += addon;
  ans %= mod;
}
int main() {
  cin >> s;
  n = s.length();
  if (s[n - 1] == '1') {
    cout << 0;
    return 0;
  }
  s[n - 1] = '0';
  for (int i = 1; i <= n - 1; i++) {
    solve(i);
  }
  cout << ans;
}