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 = 3e5 + 5;
const int mod = 998244353;
long long qpow(long long a, long long b) {
  long long ans = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b > 0 ? gcd(b, a % b) : a; }
int n, m, T;
int a[maxn];
char s[maxn];
int vis[maxn];
vector<int> g[maxn];
int p[2];
struct edge {
  int to, next, w;
} e[maxn];
int head[maxn], tot;
void add(int u, int v, int w) {
  e[tot].to = v;
  e[tot].w = w;
  e[tot].next = head[u];
  head[u] = tot++;
  e[tot].to = u;
  e[tot].w = w;
  e[tot].next = head[v];
  head[v] = tot++;
}
bool check(int x) {
  if (vis[x] == -1) vis[x] = 0;
  for (int i = head[x]; ~i; i = e[i].next) {
    if (vis[e[i].to] == -1) {
      if (e[i].w == 1) {
        vis[e[i].to] = 1 - vis[x];
      } else {
        vis[e[i].to] = vis[x];
      }
      if (!check(e[i].to)) return 0;
    } else {
      if (e[i].w == 1) {
        if (vis[x] != 1 - vis[e[i].to]) return 0;
      } else {
        if (vis[x] != vis[e[i].to]) return 0;
      }
    }
  }
  return 1;
}
long long solve() {
  for (int i = 1; i <= 2 * n + 10; i++) {
    head[i] = vis[i] = -1;
  }
  tot = 0;
  for (int i = 1; 2 * i <= n; i++) {
    add(i, n - i + 1, 0);
  }
  for (int i = 1; 2 * i <= m; i++) {
    add(i + n, m - i + 1 + n, 0);
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] == '1') {
      add(i, i + n, 1);
    } else if (s[i] == '0') {
      add(i, i + n, 0);
    }
  }
  for (int i = n + m + 1; i <= 2 * n; i++) {
    add(i, 2 * n + 2, 0);
  }
  add(2 * n + 1, 2 * n + 2, 1);
  add(n, 2 * n + 1, 0);
  add(n + m, 2 * n + 1, 0);
  int cnt = 0;
  for (int i = 1; i <= 2 * n + 2; i++) {
    if (vis[i] == -1) {
      if (check(i))
        cnt++;
      else
        return 0;
    }
  }
  return qpow(2, cnt - 1);
}
int main() {
  cin >> s + 1;
  n = strlen(s + 1);
  reverse(s + 1, s + 1 + n);
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    m = i;
    ans = (ans + solve()) % mod;
  }
  cout << ans << endl;
  return 0;
}