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 binpow(long long a, long long n) {
  if (!n) return 1;
  if (n % 2 == 0) return binpow((a * a) % 998244353ll, n / 2);
  return (a * binpow(a, n - 1)) % 998244353ll;
}
string s;
int m, n, c[2503], used[2503], col[2503], color, C, bip;
vector<pair<int, int>> g[2503], G[2503], p;
long long ans;
void addNode(int a, int b, bool c) {
  g[a].push_back(make_pair(b, c));
  g[b].push_back(make_pair(a, c));
  if (c) p.push_back(make_pair(a, b));
}
void paint(int v) {
  c[v] = color;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (c[to] || g[v][i].second) continue;
    paint(to);
  }
}
void dfs(int v, bool b = 0) {
  used[v] = color;
  col[v] = b;
  for (int i = 0; i < G[v].size(); i++) {
    int to = G[v][i].first;
    if (used[to]) {
      if (col[to] == col[v]) {
        bip = 0;
        return;
      }
      continue;
    }
    dfs(to, !b);
  }
}
int main() {
  cin >> s;
  m = s.length();
  reverse(s.begin(), s.end());
  s = "#" + s;
  if (s[1] == '1') {
    cout << 0 << endl;
    return 0;
  }
  if (s[1] == '?') s[1] = '0';
  for (int k = 1; k <= m - 1; k++) {
    n = m + m;
    p.clear();
    color = 0;
    bip = 1;
    C = 0;
    for (int i = 1; i <= n; i++) {
      c[i] = 0;
      col[i] = 0;
      used[i] = 0;
      g[i].clear();
      G[i].clear();
    }
    for (int i = 1; i <= m; i++)
      if (i != m + 1 - i) addNode(i, m + 1 - i, 0);
    for (int i = 1; i <= k; i++)
      if (i != k + 1 - i) addNode(m + i, m + k + 1 - i, 0);
    for (int i = k + 1; i <= m - 1; i++) addNode(i + m, i + 1 + m, 0);
    for (int i = 1; i <= m; i++)
      if (s[i] == '1')
        addNode(i, m + i, 1);
      else if (s[i] == '0')
        addNode(i, m + i, 0);
    for (int i = 1; i <= n; i++)
      if (c[i] == 0) {
        color++;
        paint(i);
      }
    for (int i = 0; i < p.size(); i++) {
      G[c[p[i].first]].push_back(make_pair(c[p[i].second], 1));
      G[c[p[i].second]].push_back(make_pair(c[p[i].first], 1));
    }
    for (int i = 1; i <= color; i++)
      if (!used[i]) {
        C++;
        dfs(i);
      }
    if (bip) {
      ans += binpow(2ll, C - 1);
      ans %= 998244353ll;
    }
  }
  cout << ans << endl;
  return 0;
}