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 mod = 998244353;
const int Maxn = 2005;
int n, s, t;
char str[1005];
int fath[Maxn], dis[Maxn];
int power(int a, int n, int p) {
  int ans = 1;
  a %= p;
  while (n) {
    if (n & 1) ans = 1ll * ans * a % p;
    a = 1ll * a * a % p;
    n >>= 1;
  }
  return ans;
}
int Find(int x) {
  if (fath[x] == x) return x;
  int rt = Find(fath[x]);
  dis[x] ^= dis[fath[x]];
  return fath[x] = rt;
}
bool Merge(int a, int b, int c) {
  int x = Find(a), y = Find(b);
  if (x == y) return dis[a] ^ dis[b] ^ c ^ 1;
  fath[x] = y;
  dis[x] = dis[a] ^ dis[b] ^ c;
  return true;
}
int solve(int la) {
  for (int i = 1; i <= t; ++i) {
    fath[i] = i;
    dis[i] = 0;
  }
  for (int i = 1; i <= n / 2; ++i) Merge(i, n - i + 1, 0);
  for (int i = 1; i <= la / 2; ++i) Merge(n + i, n + la - i + 1, 0);
  for (int i = la + 1; i <= n; ++i) Merge(n + i, t, 0);
  Merge(1, s, 0);
  Merge(n + 1, s, 0);
  for (int i = 1; i <= n; ++i) {
    if (str[n - i + 1] == '?') continue;
    if (!Merge(n + i, i, str[n - i + 1] - 48)) return 0;
  }
  int cnt = 0;
  for (int i = 1; i <= t; ++i) cnt += fath[i] == i;
  return power(2, cnt - 1, mod);
}
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  s = n + n + 1;
  t = s + 1;
  int ans = 0;
  for (int i = 1; i < n; ++i) ans = (ans + solve(i)) % mod;
  printf("%d\n", ans);
  return 0;
}