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 MAX_N = 1010;
const int MOD = 998244353;
vector<pair<int, int> > G[2 * MAX_N];
long long pw[2 * MAX_N], ans = 0;
int vis[2 * MAX_N], n;
bool flag = false;
string s;
void go(int x, int y, int f) {
  G[x].push_back(make_pair(y, f));
  G[y].push_back(make_pair(x, f));
}
void dfs(int x, int c) {
  if (!flag) return;
  if (vis[x] != -1) {
    if (vis[x] != c) flag = false;
    return;
  }
  vis[x] = c;
  for (int i = 0; i < G[x].size(); i++) {
    int to = G[x][i].first, f = G[x][i].second;
    if (f)
      dfs(to, 1 - c);
    else
      dfs(to, c);
  }
}
long long solve(int x) {
  for (int i = 0; i < 2 * MAX_N; i++) G[i].clear();
  memset(vis, -1, sizeof(vis));
  for (int i = 0; i < n / 2; i++) go(i, n - 1 - i, 0);
  for (int i = 0; i < x / 2; i++) go(n + i, n + x - 1 - i, 0);
  for (int i = x; i < n; i++) go(2 * n + 1, i + n, 0);
  go(2 * n + 1, 2 * n, 1);
  go(0, 2 * n, 0);
  go(n, 2 * n, 0);
  for (int i = 0; i < n; i++) {
    if (s[i] == '0')
      go(i, i + n, 0);
    else if (s[i] == '1')
      go(i, i + n, 1);
  }
  flag = true;
  int k = 0;
  for (int i = 0; i < 2 * n + 2; i++) {
    if (vis[i] == -1) {
      k++;
      dfs(i, 0);
      if (!flag) return 0;
    }
  }
  return pw[k - 1];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pw[0] = 1;
  for (int i = 1; i < 2 * MAX_N; i++) pw[i] = (pw[i - 1] + pw[i - 1]) % MOD;
  cin >> s;
  n = (int)s.size();
  reverse(s.begin(), s.end());
  for (int i = 1; i < n; i++) ans = (ans + solve(i)) % MOD;
  cout << ans << endl;
  return 0;
}