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;
int n;
string s;
struct Edge {
  int u;
  bool type;
};
vector<Edge> edges[2002];
bool visited[2002];
int color[2002];
bool dfs(int u) {
  visited[u] = true;
  bool ans = true;
  for (Edge e : edges[u])
    if (visited[e.u] == false) {
      if (color[e.u] != -1 && color[e.u] != (color[u] ^ e.type)) ans = false;
      color[e.u] = (color[u] ^ e.type);
      if (dfs(e.u) == false) ans = false;
    }
  return ans;
}
long long f(int lg) {
  for (int i = 1; i <= 2 * n; i++) edges[i].clear();
  for (int i = 1; i <= n; i++) edges[i].push_back(Edge{n - i + 1, 0});
  int cnt0 = n - lg;
  for (int i = 1; i <= lg; i++)
    edges[n + cnt0 + i].push_back(Edge{n + cnt0 + lg - i + 1, 0});
  for (int i = 1; i <= n; i++)
    if (s[i] != '?') {
      edges[n + i].push_back(Edge{i, (s[i] == '1')});
      edges[i].push_back(Edge{n + i, (s[i] == '1')});
    }
  memset(color, -1, sizeof(color));
  memset(visited, false, sizeof(visited));
  long long ans = 1;
  color[1] = 1;
  for (int i = 1; i <= cnt0; i++) color[n + i] = 0;
  color[n + cnt0 + 1] = 1;
  if (dfs(1) == false) ans = 0;
  for (int i = 1; i <= cnt0; i++) {
    if (visited[n + i] == false) {
      if (dfs(n + i) == false) ans = 0;
    }
  }
  if (visited[n + cnt0 + 1] == false) {
    if (dfs(n + cnt0 + 1) == false) ans = 0;
  }
  for (int i = 1; i <= 2 * n; i++)
    if (visited[i] == false) {
      color[i] = 1;
      if (dfs(i) == false)
        ans = 0;
      else
        ans = (ans * 2) % MOD;
    }
  return ans;
}
int main() {
  cin >> s;
  n = s.size();
  string s1 = s;
  s = " ";
  s += s1;
  long long ans = 0;
  for (int lg = 1; lg < n; lg++) ans = (ans + f(lg)) % MOD;
  cout << ans << "\n";
  return 0;
}