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 a[1001];
long long ans = 0, p[1001];
const int maxn = 2010;
vector<int> zero[maxn], one[maxn];
set<int> graph[maxn];
int par[maxn];
int root(int v) { return par[v] < 0 ? v : (par[v] = root(par[v])); }
int merge(int x, int y) {
  if ((x = root(x)) == (y = root(y))) return 0;
  if (par[y] < par[x]) swap(x, y);
  par[x] += par[y];
  par[y] = x;
  return 1;
}
vector<int> color(maxn, 0);
bool dfs(int id, int t) {
  color[id] = t;
  for (auto i : graph[id]) {
    if (color[i] == color[id]) return 0;
    if (color[i]) continue;
    if (dfs(i, 3 - t) == 0) return 0;
  }
  return 1;
}
void calc(int n) {
  for (int i = 0; i < maxn; ++i) {
    par[i] = -1;
  }
  for (int i = 0; i < maxn; ++i) {
    color[i] = 0;
    for (auto it : zero[i]) {
      merge(i, it);
    }
  }
  for (int i = 0; i < n; ++i) {
    int x = root(i);
    for (auto it : one[i]) {
      int y = root(it);
      if (x == y) return;
      graph[x].insert(y);
      graph[y].insert(x);
    }
  }
  int tot = 0;
  for (int i = 0; i < n; ++i) {
    int id = root(i);
    if (color[id]) continue;
    if (!dfs(id, 1)) return;
    tot++;
  }
  ans = (ans + p[tot - 1]) % mod;
}
void addone(int x, int y) {
  one[x].emplace_back(y);
  one[y].emplace_back(x);
}
void addzero(int x, int y) {
  zero[x].emplace_back(y);
  zero[y].emplace_back(x);
}
int n;
void f(int k) {
  for (int i = 0; i < maxn; ++i) {
    zero[i].clear();
    one[i].clear();
    graph[i].clear();
  }
  addone(1, 0);
  addzero(1, n + 2);
  for (int i = 1; i <= n / 2; ++i) {
    addzero(1 + i, 1 + n - i + 1);
  }
  for (int i = 1; i <= k / 2; ++i) {
    addzero((n + 1) + i, (n + 1) + k + 1 - i);
  }
  for (int i = 1; i <= n; ++i) {
    if (i <= n - k) {
      if (a[i] == 1)
        addzero(1, i + 1);
      else if (a[i] == 0)
        addzero(0, i + 1);
    } else {
      int j = i - n + k;
      int x = i + 1;
      int y = j + n + 1;
      if (a[i] == 1) {
        addone(x, y);
      } else if (a[i] == 0) {
        addzero(x, y);
      }
    }
  }
  calc(n + k + 2);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  for (int i = 0; i < 1001; ++i) {
    if (i)
      p[i] = (p[i - 1] * 2) % mod;
    else
      p[i] = 1;
  }
  n = s.size();
  for (int i = 0; i < n; ++i) {
    if (s[i] == '?')
      a[i + 1] = 2;
    else
      a[1 + i] = s[i] - '0';
  }
  for (int i = 1; i <= n - 1; ++i) {
    f(i);
  }
  cout << ans << '\n';
  ;
  return 0;
}