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 N = 1005, P = 998244353;
using ll = long long;
ll qpow(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % P;
    a = a * a % P;
    b >>= 1;
  }
  return ret;
}
char a[N];
int n, vis[N * 2];
vector<pair<int, int>> v[N * 2];
inline void add_edge(int uu, int vv, int ww) {
  v[uu].push_back({vv, ww});
  v[vv].push_back({uu, ww});
}
bool dfs(int pos) {
  if (vis[pos] == -1) vis[pos] = 0;
  for (auto &i : v[pos]) {
    if (vis[i.first] == -1) {
      vis[i.first] = vis[pos] ^ i.second;
      if (!dfs(i.first)) return 0;
    } else if (vis[i.first] != (vis[pos] ^ i.second))
      return 0;
  }
  return 1;
}
ll calc(int n, int m) {
  for (int i = 1; i <= n * 2 + 2; i++) v[i].clear();
  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(n * 2 - m + i, n * 2 - i + 1, 0);
  for (int i = 1; i <= n; i++)
    if (a[i] != '?') add_edge(i, n + i, a[i] - '0');
  add_edge(2 * n + 1, 1, 0);
  add_edge(2 * n + 1, 2 * n - m + 1, 0);
  for (int i = n + 1; i <= 2 * n - m; i++) add_edge(2 * n + 2, i, 0);
  memset(vis, -1, sizeof(vis));
  int cnt = 0;
  for (int i = 1; i <= n * 2 + 2; i++) {
    if (vis[i] != -1) continue;
    if (dfs(i))
      ++cnt;
    else
      return 0;
  }
  return qpow(2, cnt - 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> (a + 1);
  n = strlen(a + 1);
  ll ans = 0;
  for (int i = 1; i < n; i++) ans = (ans + calc(n, i)) % P;
  cout << ans << endl;
  return 0;
}