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 maxn = (int)5e5 + 100;
const long long inf = (1ll << 60);
const int mod2 = (int)998244353;
const int mod = (int)1e9 + 7;
string s;
int n;
vector<int> g[maxn];
vector<int> gr[maxn];
int cur;
int u[maxn];
void dfs(int v, int col) {
  u[v] = col;
  for (int to : g[v]) {
    if (u[to] == -1) {
      dfs(to, col);
    } else if (u[to] != col) {
      cur = 0;
    }
  }
  for (int to : gr[v]) {
    if (u[to] == -1) {
      dfs(to, 1 - col);
    } else if (u[to] == col) {
      cur = 0;
    }
  }
}
void clr() {
  for (int i = 0; i < 2 * n; i++) {
    g[i].clear();
    gr[i].clear();
    u[i] = -1;
  }
}
void solve() {
  cin >> s;
  n = s.size();
  if (s[n - 1] == '1') {
    cout << 0 << "\n";
    return;
  }
  s[n - 1] = '0';
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    clr();
    for (int j = 1; j < i; j++) {
      if (s[j] == '?') continue;
      if (s[j] == '1') {
        g[0].push_back(j);
        g[j].push_back(0);
      } else {
        gr[0].push_back(j);
        gr[j].push_back(0);
      }
    }
    g[n].push_back(0);
    g[0].push_back(n);
    for (int j = i; j < n; j++) {
      g[n + j - i].push_back(n + (n - 1 - i) - (j - i));
      if (s[j] == '?') continue;
      if (s[j] == '1') {
        gr[j].push_back(n + j - i);
        gr[n + j - i].push_back(j);
      } else {
        g[j].push_back(n + j - i);
        g[n + j - i].push_back(j);
      }
    }
    for (int j = 0; j < n; j++) {
      g[j].push_back(n - j - 1);
    }
    cur = 1;
    dfs(0, 1);
    for (int j = 0; j <= n + n - 1 - i; j++) {
      if (u[j] == -1) {
        dfs(j, 0);
        cur = (cur * 2ll) % mod2;
      }
    }
    ans = (ans + cur) % mod2;
  }
  cout << ans << "\n";
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}