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;
using ll = long long int;
using ii = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
using graph = vector<vii>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2123;
const ll mod = 998244353;
int seen[MAXN], color[MAXN];
string s;
graph g;
bool dfs(int u) {
  seen[u] = 1;
  int v, type;
  for (auto k : g[u]) {
    tie(v, type) = k;
    if (!seen[v]) {
      if (color[v] == -1) color[v] = color[u] ^ type;
      if (dfs(v)) return 1;
    }
    if (color[v] ^ color[u] != type) return 1;
  }
  return 0;
}
void build(int n) {
  for (int i = 0; i < n; ++i) {
    seen[i] = 0;
    color[i] = -1;
  }
  color[0] = 0;
  color[1] = 1;
}
ll bxp(int xp) {
  ll ans = 1, base = 2;
  while (xp > 0) {
    if (xp & 1) ans = ans * base % mod;
    base = base * base % mod;
    xp >>= 1;
  }
  return ans;
}
int main() {
  int n, m;
  cin >> s;
  n = s.size();
  ll ans = 0;
  for (int k = n - 1; k > 0; --k) {
    g.assign(2 + n + k + 1, vii());
    for (int i = 2 + n, j = 2 + n + k - 1; i < j; ++i, --j) {
      g[i].emplace_back(j, 0);
      g[j].emplace_back(i, 0);
    }
    for (int i = 2, j = 2 + n - 1; i < j; ++i, --j) {
      g[i].emplace_back(j, 0);
      g[j].emplace_back(i, 0);
    }
    for (int i = 0, j = 0; i < n; ++i) {
      if (s[i] == '?') {
        if (i >= n - k) ++j;
        continue;
      }
      if (i < n - k) {
        g[i + 2].emplace_back(s[i] - '0', 0);
        g[s[i] - '0'].emplace_back(i + 2, 0);
      } else {
        g[i + 2].emplace_back(j + 2 + n, s[i] - '0');
        g[j + 2 + n].emplace_back(i + 2, s[i] - '0');
        ++j;
      }
    }
    build(2 + n + k);
    g[1].emplace_back(0, 1);
    g[0].emplace_back(1, 1);
    g[n + 2].emplace_back(1, 0);
    g[1].emplace_back(n + 2, 0);
    if (dfs(0)) {
      continue;
    }
    int cnt = 0;
    bool skip = 0;
    for (int i = 2; i < 2 + n + k && !skip; ++i) {
      if (!seen[i]) {
        color[i] = 0;
        if (dfs(i)) {
          skip = 1;
        }
        ++cnt;
      }
    }
    if (skip) continue;
    ans += bxp(cnt);
    if (ans >= mod) ans -= mod;
  }
  cout << ans << '\n';
}