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 = 2003, yyb = 998244353, inv2 = 499122177;
char s[N];
vector<int> g[N], h[N];
int belong[N], cntNode;
void dfs1(int x) {
  belong[x] = cntNode;
  for (auto y : g[x])
    if (!belong[y]) dfs1(y);
}
int col[N];
bool dfs2(int x, int color) {
  col[x] = color;
  for (auto y : h[x]) {
    if (!col[y]) {
      if (dfs2(y, 3 - color)) return 1;
    } else if (color == col[y])
      return 1;
  }
  return 0;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1), m, i, k, tmp, ans = 0;
  for (k = 1; k < n; ++k) {
    m = n + k;
    for (i = 0; i <= m; ++i) g[i].clear(), belong[i] = 0;
    for (i = 1; i <= n; ++i) g[i].push_back(n - i + 1);
    for (i = 1; i <= k; ++i) g[n + i].push_back(n + k - i + 1);
    for (i = 1; i <= n - k; ++i)
      if (s[i] == '0') g[0].push_back(i), g[i].push_back(0);
    for (; i <= n; ++i)
      if (s[i] == '0') g[i].push_back(i + k), g[i + k].push_back(i);
    cntNode = 0;
    for (i = 0; i <= m; ++i)
      if (!belong[i]) col[++cntNode] = 0, h[cntNode].clear(), dfs1(i);
    for (i = 1; i <= n - k; ++i)
      if (s[i] == '1') {
        if (belong[0] == belong[i]) break;
        h[belong[0]].push_back(belong[i]), h[belong[i]].push_back(belong[0]);
      }
    if (i <= n - k) continue;
    for (; i <= n; ++i)
      if (s[i] == '1') {
        if (belong[i] == belong[i + k]) break;
        h[belong[i]].push_back(belong[i + k]),
            h[belong[i + k]].push_back(belong[i]);
      }
    if (i <= n) continue;
    if (belong[0] == belong[n + 1]) continue;
    h[belong[0]].push_back(belong[n + 1]),
        h[belong[n + 1]].push_back(belong[0]), tmp = 1;
    int cnt = 0;
    for (i = 1; i <= cntNode; ++i)
      if (!col[i]) {
        if (dfs2(i, 1)) break;
        tmp = (tmp << 1) % yyb;
        ++cnt;
      }
    if (i > cntNode) ans = (1ll * tmp * inv2 + ans) % yyb;
  }
  printf("%d\n", ans);
  return 0;
}