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 int maxn = 2e3 + 100;
const int mod = 998244353;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, par[maxn];
string s;
void init() {
  for (int i = 1; i <= 2 * n; i++) par[i] = i;
}
int root(int v) { return v == par[v] ? v : par[v] = root(par[v]); }
void unite(int a, int b) {
  a = root(a), b = root(b);
  if (a == b) return;
  par[b] = a;
}
long long ans;
int side[maxn];
vector<int> adj[maxn];
bool dfs(int v, int parity) {
  if (side[v] == parity) return true;
  if (side[v] == -1) side[v] = parity;
  if (side[v] != parity) return false;
  for (int to : adj[v])
    if (!dfs(to, parity ^ 1)) return false;
  return true;
}
void solve(int fr) {
  init();
  memset(side, -1, sizeof side);
  for (int i = 0; i <= 2 * n; i++) adj[i].clear();
  for (int i = 1; i <= n; i++) unite(i, n - i + 1);
  for (int i = fr; i <= n; i++) unite(i + n, n - (i - fr) + n);
  for (int i = fr; i <= n; i++)
    if (s[i] == '0') unite(i, i + n);
  for (int i = fr; i <= n; i++) {
    if (s[i] == '1') {
      adj[root(i)].push_back(root(i + n));
      adj[root(i + n)].push_back(root(i));
    }
  }
  for (int i = 1; i < fr; i++) {
    if (s[i] == '?') continue;
    if (!dfs(root(i), (s[i] - '0'))) return;
  }
  if (!dfs(root(fr + n), 1)) return;
  long long add = 1;
  for (int i = 1; i <= n; i++) {
    if (par[i] == i && side[i] == -1) {
      add = (add * 2) % mod;
      if (!dfs(i, 0)) return;
    }
  }
  for (int i = fr; i <= n; i++) {
    if (par[i + n] == i + n && side[i + n] == -1) {
      add = (add * 2) % mod;
      if (!dfs(i + n, 0)) return;
    }
  }
  ans += add;
  ans %= mod;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> s;
  n = (int)s.size();
  s = 'x' + s;
  for (int i = 2; i <= n; i++) solve(i);
  cout << ans << "\n";
  return 0;
}