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 = 2100;
const long long MOD = 998244353;
int N;
string s;
bool bad;
bool seen[MAXN];
int cval[MAXN];
vector<pair<int, int> > edges[MAXN];
void flood(int x, int cv) {
  if (seen[x]) {
    if (cval[x] != cv) {
      bad = true;
    }
    return;
  }
  seen[x] = true;
  cval[x] = cv;
  for (pair<int, int> e : edges[x]) {
    flood(e.first, cv ^ e.second);
  }
}
long long gogo() {
  bad = false;
  int nc = 0;
  for (int i = 0; i < 2 * N + 2; i++) {
    if (!seen[i]) {
      flood(i, 0);
      nc++;
    }
  }
  if (bad) return 0;
  long long ans = 1;
  for (int i = 0; i + 1 < nc; i++) {
    ans = (2 * ans) % MOD;
  }
  return ans;
}
long long get_res(int M) {
  for (int i = 0; i < MAXN; i++) {
    seen[i] = false;
    cval[i] = -1;
    edges[i].clear();
  }
  for (int i = 0; i < N; i++) {
    edges[i].push_back(make_pair(N - 1 - i, 0));
  }
  for (int i = 0; i < M; i++) {
    edges[N + i].push_back(make_pair(N + (M - 1 - i), 0));
  }
  for (int i = M; i < N; i++) {
    edges[N + i].push_back(make_pair(2 * N, 0));
    edges[2 * N].push_back(make_pair(N + i, 0));
  }
  edges[2 * N].push_back(make_pair(2 * N + 1, 1));
  edges[2 * N + 1].push_back(make_pair(2 * N, 1));
  for (int i = 0; i < N; i++) {
    char c = s[N - 1 - i];
    if (c == '0') {
      edges[i].push_back(make_pair(N + i, 0));
      edges[N + i].push_back(make_pair(i, 0));
    } else if (c == '1') {
      edges[i].push_back(make_pair(N + i, 1));
      edges[N + i].push_back(make_pair(i, 1));
    }
  }
  edges[0].push_back(make_pair(2 * N + 1, 0));
  edges[2 * N + 1].push_back(make_pair(0, 0));
  edges[N].push_back(make_pair(2 * N + 1, 0));
  edges[2 * N + 1].push_back(make_pair(N, 0));
  return gogo();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  N = s.length();
  long long ans = 0;
  for (int i = 1; i < N; i++) {
    ans = (ans + get_res(i)) % MOD;
  }
  cout << ans << "\n";
}