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 mod = 998244353;
int n;
vector<pair<int, int>> g[2005];
int col[2005];
bool visited[2005], isb = 1;
void addedge(int u, int v, int w) {
  g[u].emplace_back(v, w);
  g[v].emplace_back(u, w);
}
void dfs(int u) {
  visited[u] = 1;
  for (auto v : g[u]) {
    if (!visited[v.first]) dfs(v.first);
  }
}
void dfsb(int u, int c) {
  visited[u] = 1;
  col[u] = c;
  for (auto x : g[u]) {
    if (!visited[x.first]) {
      dfsb(x.first, (c ^ x.second));
    } else {
      if (col[x.first] != c ^ x.second) {
        isb = 0;
      }
    }
  }
}
void isbip() {
  isb = 1;
  memset(visited, 0, sizeof(visited));
  dfsb(2 * n, 0);
  if (visited[2 * n + 1]) {
    if (col[2 * n + 1] != 1) isb = 0;
  } else
    dfsb(2 * n + 1, 1);
  for (int i = 0; i < 2 * n; i++) {
    if (!visited[i]) {
      dfsb(i, 0);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  n = s.size();
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int cur = 1;
    memset(visited, 0, sizeof(visited));
    memset(col, -1, sizeof(col));
    for (int j = 0; j < 2 * n + 2; j++) g[j].clear();
    addedge(0, 2 * n + 1, 0);
    for (int j = 0; j < i; j++) {
      addedge(n + j, 2 * n, 0);
    }
    addedge(n + i, 2 * n + 1, 0);
    for (int j = 0; j < n; j++) {
      if (s[j] == '0') {
        addedge(j, n + j, 0);
      } else if (s[j] == '1') {
        addedge(j, n + j, 1);
      }
    }
    for (int j = 0; j < n; j++) {
      addedge(j, n - j - 1, 0);
    }
    for (int j = i; j < n; j++) {
      addedge(n + j, 2 * n - j + i - 1, 0);
    }
    dfs(2 * n);
    dfs(2 * n + 1);
    for (int j = 0; j < 2 * n; j++) {
      if (!visited[j]) {
        cur = (2 * cur) % mod;
        dfs(j);
      }
    }
    isbip();
    ans = (ans + cur * isb) % mod;
  }
  cout << ans << endl;
  return 0;
}