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 long long p = 998244353;
const long long maxn = 2e3 + 3;
vector<pair<long long, pair<long long, long long> > > a;
vector<pair<long long, long long> > b[maxn];
bool used[maxn];
long long color[maxn];
bool z;
void dfs(long long x, long long c) {
  used[x] = true;
  color[x] = c;
  for (auto v : b[x]) {
    if (!used[v.first]) {
      dfs(v.first, c ^ v.second);
    } else {
      if (color[v.first] != (c ^ v.second)) {
        z = false;
      }
    }
  }
}
long long slv(long long sz) {
  for (long long i = 0; i <= sz; ++i) b[i].clear();
  z = true;
  for (auto h : a) {
    b[h.second.first].push_back({h.second.second, h.first});
    b[h.second.second].push_back({h.second.first, h.first});
  }
  for (long long i = 0; i < maxn; ++i) used[i] = false;
  long long cnt = 1;
  for (long long i = 0; i <= sz; ++i) {
    if (!used[i]) {
      cnt *= 2;
      cnt %= p;
      dfs(i, 0);
    }
  }
  if (z)
    return cnt;
  else
    return 0;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long n = s.size();
  long long ans = 0;
  for (long long i = 1; i < n; ++i) {
    a.clear();
    a.push_back({1, {0, n + 1}});
    for (long long j = 1; j <= n; ++j) {
      a.push_back({0, {j, n - j + 1}});
    }
    for (long long j = 1; j <= (n - i); ++j) {
      a.push_back({0, {n + j, 2 * n - i - j + 1}});
    }
    for (long long j = 1; j <= i; ++j) {
      if (s[j - 1] != '?') a.push_back({s[j - 1] - '0', {0, j}});
    }
    for (long long j = (i + 1); j <= n; ++j) {
      if (s[j - 1] != '?') a.push_back({s[j - 1] - '0', {j, n + j - i}});
    }
    long long sz = (2 * n - i);
    if (i != 0)
      ans += (slv(sz) * (p + 1) / 2);
    else
      ans += (slv(sz) * (3 * p + 1) / 4);
    ans %= p;
  }
  cout << ans;
  return 0;
}