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 N = 2e3 + 100;
const int MOD = 998244353;
string s;
struct Graph {
  bool bipartite;
  int color[N];
  int n;
  struct Edge {
    int u, v, same;
    Edge(int u = 0, int v = 0, int same = 0) : u(u), v(v), same(same){};
    int nxt(int x) { return x ^ u ^ v; }
  };
  vector<Edge> adj[N];
  void addEdge(int u, int v, int same) {
    adj[u].push_back({u, v, same});
    adj[v].push_back({u, v, same});
  }
  void dfs(int u) {
    if (!bipartite) return;
    for (auto &edge : adj[u]) {
      int v = edge.nxt(u);
      if (color[v]) {
        if (edge.same && color[v] != color[u]) {
          bipartite = false;
          return;
        }
        if (!edge.same && color[v] == color[u]) {
          bipartite = false;
          return;
        }
        continue;
      }
      if (edge.same)
        color[v] = color[u];
      else
        color[v] = 3 - color[u];
      dfs(v);
    }
  }
  void initial(int nv, int lens) {
    n = 2 * lens;
    bipartite = true;
    memset(color, 0, sizeof color);
    for (int i = 1; i <= n; ++i) adj[i].clear();
    for (int i = nv + 1; i <= lens; ++i) {
      color[i + lens] = 1;
      if (s[i] == '1') color[i] = 2;
      if (s[i] == '0') color[i] = 1;
    }
    color[nv + lens] = color[lens] = 2;
    for (int i = 1; i <= lens / 2; ++i) addEdge(i, lens - i + 1, 1);
    for (int i = 1; i <= nv / 2; ++i) addEdge(i + lens, nv - i + 1 + lens, 1);
    for (int i = 1; i <= nv; ++i)
      if (s[i] == '?')
        continue;
      else
        addEdge(i, i + lens, (s[i] == '0'));
    for (int i = 1; i <= n; ++i)
      if (color[i]) dfs(i);
  }
  long long px(int n) {
    if (n == 0) return 1;
    long long tmp = px(n >> 1);
    tmp = (tmp * tmp) % MOD;
    if (n & 1) tmp = (tmp + tmp) % MOD;
    return tmp;
  }
  long long ways() {
    long long comp = 0;
    for (int i = 1; i <= n; ++i)
      if (!color[i]) {
        color[i] = 1;
        dfs(i);
        comp++;
      }
    if (!bipartite) return 0;
    return px(comp);
  }
} graph;
int main() {
  cin >> s;
  reverse(s.begin(), s.end());
  int n = s.size();
  s = ' ' + s;
  long long rez = 0;
  for (int i = 1; i <= n; ++i) {
    graph.initial(i, n);
    long long ways = graph.ways();
    rez = (rez + ways) % MOD;
  }
  cout << rez;
}