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 maxn = 5222;
const long long mod = 998244353;
long long n;
long long ori[maxn];
vector<long long> G[maxn];
vector<long long> LEN[maxn];
void build(long long alen, long long blen) {
  for (long long i = 1; i <= alen + blen; i++) {
    G[i].clear();
    LEN[i].clear();
  }
  for (long long i = 1; i <= blen; i++) {
    if (ori[i] == -1) continue;
    G[i].push_back(i + n);
    G[i + n].push_back(i);
    LEN[i].push_back(ori[i]);
    LEN[i + n].push_back(ori[i]);
  }
  for (long long i = 1; i <= alen; i++) {
    long long j = alen - i + 1;
    if (i <= j) {
      G[i].push_back(j);
      G[j].push_back(i);
      LEN[i].push_back(0);
      LEN[j].push_back(0);
    }
  }
  for (long long i = 1; i <= blen; i++) {
    long long j = blen - i + 1;
    if (i <= j) {
      G[i + n].push_back(j + n);
      G[j + n].push_back(i + n);
      LEN[i + n].push_back(0);
      LEN[j + n].push_back(0);
    }
  }
}
long long val[maxn];
void dfs(long long nowid, long long fa) {
  long long pos = nowid % n;
  if (pos == 0) pos = n;
  for (long long i = 0; i < G[nowid].size(); i++) {
    long long d = G[nowid][i];
    long long dval = val[nowid] ^ LEN[nowid][i];
    if (d == fa || val[d] == dval) continue;
    val[d] = dval;
    dfs(d, nowid);
  }
}
void solve() {
  string str;
  cin >> str;
  n = str.size();
  for (long long i = 0; i < n; i++) {
    ori[i + 1] = str[i] - '0';
    if (str[i] == '?') ori[i + 1] = -1;
  }
  reverse(ori + 1, ori + 1 + n);
  long long ans = 0;
  for (long long blen = 1; blen < n; blen++) {
    build(n, blen);
    memset(val, -1, sizeof(val));
    long long ok = 1;
    for (long long i = blen + 1; i <= n; i++) {
      if (ori[i] != -1) {
        if (val[i] == -1) {
          val[i] = ori[i];
          dfs(i, i);
        } else if (val[i] != ori[i]) {
          ok = 0;
          break;
        }
      }
    }
    if (ok == 0) continue;
    if (val[n + 1] == 0) continue;
    if (val[n + 1] == -1) {
      val[n + 1] = 1;
      dfs(n + 1, n + 1);
    }
    long long tempans = 1;
    for (long long i = 1; i <= blen + n; i++) {
      if (val[i] == -1) {
        val[i] = 0;
        dfs(i, i);
        tempans = tempans * 2 % mod;
      }
    }
    ans += tempans;
    ans %= mod;
  }
  printf("%lld\n", ans % mod);
}
signed main() { solve(); }