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 = 3e5 + 100, OO = 1e9 + 7, T = 13, M = 998244353, P = 6151,
          SQ = 360, LG = 15;
int n, p2[N], ans, fa[N], top[N];
char s[N];
int cx(int x) {
  if (fa[x] == x) return x;
  int y = cx(fa[x]);
  top[x] ^= top[fa[x]];
  fa[x] = y;
}
bool zm(int x, int y, int op) {
  int ix = cx(x), iy = cx(y);
  if (ix != iy) return fa[iy] = ix, top[iy] = op ^ top[x] ^ top[y], 1;
  return top[x] ^ top[y] ^ (!op) & 1;
}
int solve(int st) {
  for (int i = 1; i <= (n << 1); i++) fa[i] = i, top[i] = 0;
  for (int i = 1; (i << 1) <= n; i++) zm(i, n - i + 1, 0);
  for (int i = 1; (i << 1) <= n - st + 1; i++)
    zm(st + i - 1 + n, (n << 1) - i + 1, 0);
  for (int i = 1; i <= n; i++)
    if (s[i] != '?')
      if (!zm(i, i + n, s[i] - '0')) return 0;
  for (int i = 1; i < st - 1; i++)
    if (!zm(i + n, i + 1 + n, 0)) return 0;
  if (!zm(1, 1 + n, 1)) return 0;
  if (!zm(st - 1 + n, st + n, 1)) return 0;
  int cnt = 0;
  for (int i = 1; i <= (n << 1); i++)
    if (fa[i] == i) cnt++;
  return p2[cnt - 1];
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  scanf("%s", s + 1);
  n = strlen(s + 1);
  p2[0] = 1;
  for (int i = 1; i <= (n << 1); i++) p2[i] = (p2[i - 1] << 1) % M;
  for (int i = 2; i <= n; i++) ans = (ans + solve(i)) % M;
  cout << ans << endl;
  return 0;
}