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 = 2005;
const int mod = 998244353;
int n, vis[N], fg, tot, bin[N], ans;
char str[N];
vector<int> E[N];
void link(int u, int v, int w) {
  E[u].push_back(v << 1 | w);
  E[v].push_back(u << 1 | w);
}
void dfs(int u, int c) {
  vis[u] = c;
  for (int v : E[u])
    if (vis[v >> 1] == -1)
      dfs(v >> 1, c ^ (v & 1));
    else if (vis[v >> 1] ^ c ^ (v & 1))
      fg = 1;
}
int check(int m) {
  for (int i = 1; i <= n + m + 2; ++i) E[i].clear(), vis[i] = -1;
  for (int i = 1; i + i <= n; ++i) link(i, n + 1 - i, 0);
  for (int i = 1; i + i <= m; ++i) link(n + i, n + m + 1 - i, 0);
  for (int i = 1; i <= m; ++i)
    if (str[i] != '?') link(i, n + i, str[i] - '0');
  for (int i = m + 1; i <= n; ++i)
    if (str[i] != '?') link(i, n + m + 1 + str[i] - '0', 0);
  link(n, n + m + 2, 0);
  link(n + m, n + m + 2, 0);
  link(n + m + 1, n + m + 2, 1);
  fg = tot = 0;
  for (int i = 1; i <= n + m + 2; ++i)
    if (vis[i] == -1) ++tot, dfs(i, 0);
  int res = fg ? 0 : bin[tot - 1];
  return res;
}
int main() {
  bin[0] = 1;
  for (int i = 1; i < N; ++i) bin[i] = (bin[i - 1] << 1) % mod;
  scanf("%s", str + 1);
  n = strlen(str + 1);
  reverse(str + 1, str + n + 1);
  for (int i = 1; i < n; ++i) ans = (ans + check(i)) % mod;
  printf("%d\n", ans);
  return 0;
}