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 = 2e3 + 100;
const long long mod = 998244353;
const long long inv = 499122177;
vector<pair<int, int> > gfo[N];
bool vst[N];
int need[N];
string s;
void build(int n, int m) {
  int nn = (n + 1) / 2, mm = (m + 1) / 2;
  memset(need, -1, sizeof(need));
  for (int i = int(0); i < int(N); ++i) gfo[i].clear();
  for (int i = int(0); i < int(nn); ++i) {
    int j = n - 1 - i;
    if (i != j) {
      gfo[i].push_back({j, 0});
      gfo[j].push_back({i, 0});
    }
  }
  for (int i = int(0); i < int(mm); ++i) {
    int j = m - 1 - i;
    if (i != j) {
      gfo[i + n].push_back({j + n, 0});
      gfo[j + n].push_back({i + n, 0});
    }
  }
  for (int i = int(m); i < int(n); ++i) {
    if (s[i] == '1') need[i] = 1;
    if (s[i] == '0') need[i] = 0;
    if (s[i] == '?') need[i] = -1;
  }
  need[n + m - 1] = 1;
  for (int i = int(0); i < int(m); ++i) {
    int val;
    if (s[i] == '1') val = 1;
    if (s[i] == '0') val = 0;
    if (s[i] == '?') val = -1;
    gfo[i].push_back({i + n, val});
    gfo[i + n].push_back({i, val});
  }
}
long long go(int u, long long val, int cur) {
  vst[u] = true;
  if (cur == -1) {
    if (need[u] == -1) {
      for (pair<int, int> p : gfo[u])
        if (!vst[p.first]) {
          if (p.second == -1)
            return go(p.first, (val * 2) % mod, -1);
          else
            return go(p.first, val, -1);
        }
    } else {
      val = (val * inv) % mod;
      for (pair<int, int> p : gfo[u])
        if (!vst[p.first]) {
          if (p.second == -1)
            return go(p.first, (2 * val) % mod, -1);
          else
            return go(p.first, val, need[u] ^ p.second);
        }
    }
  } else {
    if (need[u] == -1) {
      for (pair<int, int> p : gfo[u])
        if (!vst[p.first]) {
          if (p.second == -1)
            return go(p.first, (2 * val) % mod, -1);
          else
            return go(p.first, val, cur ^ p.second);
        }
    } else {
      int sat = (cur == need[u]);
      for (pair<int, int> p : gfo[u])
        if (!vst[p.first]) {
          if (p.second == -1)
            return sat * go(p.first, 2 * val, -1);
          else
            return sat * go(p.first, val, cur ^ p.second);
        }
      if (sat == 0) return 0;
    }
  }
  return val;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  reverse((s).begin(), (s).end());
  int n = int((s).size());
  long long ans = 0;
  for (int i = int(1); i < int(n); ++i) {
    build(n, i);
    int m = n + i;
    long long ret = 1;
    memset(vst, false, sizeof(vst));
    for (int j = int(n - 1); j >= int(0); j--)
      if (!vst[j]) {
        int val, lel;
        if (s[j] == '1') val = 1, lel = 1;
        if (s[j] == '0') val = 1, lel = 0;
        if (s[j] == '?') val = 2, lel = -1;
        ret = (ret * go(j, val, lel)) % mod;
      }
    ans = (ans + ret) % mod;
  }
  cout << ans << endl;
  return 0;
}