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 MAXN = 2005;
const int mod = 998244353;
vector<int> G[MAXN];
int mul[MAXN];
char s[1005];
int fa[MAXN];
inline int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
inline void link(int x, int y) {
  if ((x = find(x)) != (y = find(y))) fa[y] = x;
}
inline void add(int x, int y) {
  G[x].push_back(y);
  G[y].push_back(x);
}
int vis[MAXN];
bool dfs(int u, int col) {
  vis[u] = col;
  int siz = G[u].size(), v;
  for (int i = 0; i < siz; ++i)
    if (!(~vis[v = G[u][i]])) {
      if (!dfs(v, col ^ 1)) return 0;
    } else if (vis[v] == vis[u])
      return 0;
  return 1;
}
inline int solve(int n, int k) {
  int one = n + k + 1, zero = n + k + 2;
  for (int i = 1; i <= zero; ++i) fa[i] = i, G[i].clear(), vis[i] = -1;
  for (int i = 1; i <= n - k; ++i)
    if (s[i] == '0')
      link(i, zero);
    else if (s[i] == '1')
      link(i, one);
  for (int i = n - k + 1; i <= n; ++i)
    if (s[i] == '0') link(i, i + k);
  for (int i = 1; i < n - i + 1; ++i) link(i, n - i + 1);
  for (int i = 1; i < k - i + 1; ++i) link(n + i, n + k - i + 1);
  link(one, n + 1);
  for (int i = 1; i <= zero; ++i) find(i);
  add(fa[one], fa[zero]);
  for (int i = n - k + 1; i <= n; ++i)
    if (s[i] == '1') add(fa[i], fa[i + k]);
  int re = 0;
  for (int i = 1; i <= zero; ++i)
    if (!(~vis[fa[i]])) {
      if (!dfs(fa[i], 0)) return 0;
      ++re;
    }
  return mul[re - 1];
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  mul[0] = 1;
  for (int i = 1; i <= 2 * n; ++i) mul[i] = 2ll * mul[i - 1] % mod;
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    ans = (ans + solve(n, i)) % mod;
  }
  printf("%d\n", (ans + mod) % mod);
}