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;
int n;
char s[2000 + 5];
int p2[2000 + 5], a[2000 + 5], b[2000 + 5];
int vis[2000 + 5], col[2000 + 5];
int cnt, ans, cp;
vector<pair<int, int> > G[2000 + 5];
void add(int u, int v, int w) {
  G[u].push_back(pair<int, int>(v, w));
  G[v].push_back(pair<int, int>(u, w));
}
bool dfs(int x) {
  for (int i = 0; i < G[x].size(); i++) {
    int nxt = G[x][i].first;
    if (!vis[nxt]) {
      vis[nxt] = 2;
      col[nxt] = col[x] ^ G[x][i].second;
      if (dfs(nxt)) return 1;
    } else if (col[nxt] ^ col[x] ^ G[x][i].second)
      return 1;
  }
  return 0;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  p2[0] = 1;
  for (int i = 1; i <= 2000; i++) p2[i] = (2LL * p2[i - 1]) % 998244353;
  for (int st = 2; st <= n; st++) {
    cnt = 0;
    cp = ++cnt;
    for (int i = 1; i <= n; i++) a[i] = ++cnt;
    for (int i = st; i <= n; i++) b[i] = ++cnt;
    add(a[1], cp, 1), add(b[st], cp, 1);
    for (int i = st; i <= n; i++)
      if (s[i] == '0')
        add(a[i], b[i], 0);
      else if (s[i] == '1')
        add(a[i], b[i], 1);
    for (int i = 1; i < st; i++)
      if (s[i] == '0')
        add(a[i], cp, 0);
      else if (s[i] == '1')
        add(a[i], cp, 1);
    for (int i = 1, j = n; i < j; i++, j--) add(a[i], a[j], 0);
    for (int i = st, j = n; i < j; i++, j--) add(b[i], b[j], 0);
    int c = 0;
    for (int i = 1; i <= cnt; i++)
      if (!vis[i]) {
        ++c;
        if (dfs(i)) {
          c = -1;
          break;
        }
      }
    if (~c) ans = (ans + p2[c - 1]) % 998244353;
    for (int i = 1; i <= cnt; i++) vis[i] = 0, G[i].clear();
  }
  printf("%d", ans);
}