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 MOD = 998244353;
const int N = 2000 + 20;
vector<pair<int, int>> vec[N];
bool visit[N];
string str;
int n;
int color[N];
void addedge(int u, int v, int w) {
  vec[u].push_back({v, w});
  vec[v].push_back({u, w});
}
bool dfs(int u, int c) {
  color[u] = c;
  visit[u] = 1;
  for (const auto &e : vec[u]) {
    int v = e.first;
    int w = e.second;
    int nc = w ^ c;
    if (!visit[v]) {
      if (!dfs(v, nc)) return false;
    } else {
      if (nc != color[v]) return false;
    }
  }
  return true;
}
long long calc(int m) {
  int tot = 2 * n + 2;
  for (int i = 0; i < tot; i++) {
    vec[i].clear();
    color[i] = 0;
    visit[i] = false;
  }
  int zero = 2 * n;
  int one = zero + 1;
  addedge(zero, one, 1);
  addedge(n, one, 0);
  addedge(m, one, 0);
  for (int i = 0; i < m; i++) {
    if (str[i] == '1') {
      addedge(i + n, one, 0);
    } else if (str[i] == '0') {
      addedge(i + n, zero, 0);
    }
  }
  for (int i = m; i < n; i++) {
    if (str[i] == '1') {
      addedge(i, i + n, 1);
    } else if (str[i] == '0') {
      addedge(i, i + n, 0);
    }
  }
  int L = 0, R = n - 1;
  while (L < R) {
    addedge(L + n, R + n, 0);
    L++, R--;
  }
  L = m, R = n - 1;
  while (L < R) {
    addedge(L, R, 0);
    L++, R--;
  }
  int cc = 0;
  long long res = 1;
  for (int i = m; i < tot; i++) {
    if (!visit[i]) {
      cc++;
      if (cc > 1) {
        res <<= 1;
        res %= MOD;
      }
      if (!dfs(i, 0)) return 0;
    }
  }
  return res;
}
void solve() {
  cin >> str;
  n = str.length();
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    long long ret = calc(i);
    ans += ret;
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}