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>
#pragma GCC optimize(2)
using namespace std;
string s;
long long n, ans;
long long val[2010], pw[2010];
bool vis[2010];
vector<pair<long long, long long> > v[2010];
inline bool dfs(long long loc) {
  for (long long ii = 0; ii < v[loc].size(); ii++) {
    long long u = v[loc][ii].first;
    long long cur = val[loc] ^ v[loc][ii].second;
    if (val[u] != -1) {
      if (val[u] != cur) {
        return false;
      } else {
        vis[u] = 1;
        continue;
      }
    }
    if (vis[u]) continue;
    val[u] = cur;
    vis[u] = 1;
    dfs(u);
  }
  return true;
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> s;
  n = s.size();
  pw[0] = 1;
  for (long long i = 1; i <= 2000; i++) {
    pw[i] = pw[i - 1] * 2;
    pw[i] %= 998244353;
  }
  for (long long i = 1; i < n; i++) {
    memset(val, -1, sizeof(val));
    memset(vis, 0, sizeof(vis));
    for (long long j = 1; j <= 2 * n; j++) v[j].clear();
    queue<long long> q;
    for (long long j = 1; j <= n - i; j++)
      if (s[j - 1] != '?') {
        val[j] = s[j - 1] - '0';
        q.push(j);
        vis[j] = 1;
      }
    val[n + 1] = 1;
    q.push(n + 1);
    vis[n + 1] = 1;
    for (long long j = 1; j <= n / 2; j++) {
      long long rev = n + 1 - j;
      v[j].push_back(make_pair(rev, 0));
      v[rev].push_back(make_pair(j, 0));
    }
    for (long long k = 1; k <= i / 2; k++) {
      long long rev = i + 1 - k;
      v[k + n].push_back(make_pair(rev + n, 0));
      v[rev + n].push_back(make_pair(k + n, 0));
    }
    for (long long k = n - i + 1; k <= n; k++) {
      if (s[k - 1] == '?') continue;
      v[k].push_back(make_pair(k + i, s[k - 1] - '0'));
      v[k + i].push_back(make_pair(k, s[k - 1] - '0'));
    }
    long long last = i + n;
    bool flag = false;
    while (!q.empty()) {
      long long t = q.front();
      q.pop();
      bool rr = false;
      for (long long ii = 0; ii < v[t].size(); ii++) {
        long long u = v[t][ii].first;
        long long cur = v[t][ii].second ^ val[t];
        if (val[u] != -1) {
          if (val[u] != cur) {
            flag = true;
            rr = true;
            break;
          } else {
            vis[u] = 1;
            continue;
          }
        }
        if (vis[u]) continue;
        vis[u] = 1;
        val[u] = cur;
        q.push(u);
      }
      if (rr) break;
    }
    if (flag) continue;
    long long cnt = 0;
    for (long long j = 1; j <= last; j++)
      if (!vis[j]) {
        vis[j] = 1;
        val[j] = 0;
        if (!dfs(j)) {
          flag = true;
          break;
        } else
          cnt++;
      }
    if (flag) continue;
    ans += pw[cnt];
    ans %= 998244353;
  }
  cout << ans << endl;
  return 0;
}