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 = 1005;
string s;
int n, a[maxn], dp[2][maxn][maxn][2];
bool ok[maxn];
void readf() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; ++i) {
    if (s[i] == '?') {
      a[i + 1] = 2;
      continue;
    }
    a[i + 1] = s[i] - '0';
  }
}
int f(int id, int pos, int i, int type) {
  int &rs = dp[id][pos][i][type];
  if (rs != -1) return rs;
  if (id) {
    ok[i] = ok[n + 1 - i] = 1;
    if (i == n + 1 - i) return 1;
    if (n + 1 - i < pos)
      return (rs = (a[n + 1 - i] == 2 || a[n + 1 - i] == type));
    if (a[n + 1 - i] < 2) return rs = f(0, pos, n + 1 - i, type ^ a[n + 1 - i]);
    return (rs = (f(0, pos, n + 1 - i, 0) + f(0, pos, n + 1 - i, 1)) % mod);
  }
  ok[i] = ok[n + pos - i] = 1;
  if (n + pos - i == pos && type == 0) return 0;
  if (i == n + pos - i) return 1;
  if (a[n + pos - i] < 2)
    return rs = f(1, pos, n + pos - i, type ^ a[n + pos - i]);
  return (rs = (f(1, pos, n + pos - i, 0) + f(1, pos, n + pos - i, 1)) % mod);
}
void solve() {
  memset(dp, -1, sizeof(dp));
  int mid = n + 1 >> 1, ans = 0;
  for (int pos = 2; pos <= n; ++pos) {
    memset(ok, 0, sizeof(ok));
    int rs = 1;
    for (int i = 1; i <= n; ++i)
      if (!ok[i])
        if (a[i] == 2)
          rs = 1LL * rs * (f(1, pos, i, 0) + f(1, pos, i, 1)) % mod;
        else
          rs = 1LL * rs * f(1, pos, i, a[i]) % mod;
    ans = (ans + rs) % mod;
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  readf();
  solve();
}