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;
vector<vector<int>> e1, e2;
vector<int> v;
vector<bool> b;
bool res;
void dfs(int a) {
  b[a] = true;
  for (int i = 0; i < e1[a].size(); i++) {
    if (v[a] != v[e1[a][i]] && v[e1[a][i]] != -1) res = false;
    if (b[e1[a][i]]) continue;
    v[e1[a][i]] = v[a];
    dfs(e1[a][i]);
  }
  for (int i = 0; i < e2[a].size(); i++) {
    if (v[a] == v[e2[a][i]] && v[e2[a][i]] != -1) res = false;
    if (b[e2[a][i]]) continue;
    v[e2[a][i]] = 1 - v[a];
    dfs(e2[a][i]);
  }
}
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> p(n + 1);
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % MOD;
  int ans = 0;
  for (int i = 1; i < n; i++) {
    v = vector<int>(n + i + 2, -1);
    v[n + i] = 1;
    v[n + i + 1] = 0;
    e1 = vector<vector<int>>(n + i + 2, vector<int>());
    e2 = vector<vector<int>>(n + i + 2, vector<int>());
    e1[0].push_back(n + i);
    e1[n + i].push_back(0);
    e1[n].push_back(n + i);
    e1[n + i].push_back(n);
    for (int j = 0; j < n / 2; j++) {
      e1[j].push_back(n - 1 - j);
      e1[n - 1 - j].push_back(j);
    }
    for (int j = 0; j < i / 2; j++) {
      e1[j + n].push_back(n + i - 1 - j);
      e1[n + i - 1 - j].push_back(j + n);
    }
    for (int j = 0; j < i; j++) {
      if (s[n - 1 - j] == '0') {
        e1[n + i - 1 - j].push_back(n - 1 - j);
        e1[n - 1 - j].push_back(n + i - 1 - j);
      } else if (s[n - 1 - j] == '1') {
        e2[n + i - 1 - j].push_back(n - 1 - j);
        e2[n - 1 - j].push_back(n + i - 1 - j);
      }
    }
    for (int j = i; j < n; j++) {
      if (s[n - 1 - j] == '0') {
        e1[n - 1 - j].push_back(n + i + 1);
        e1[n + i + 1].push_back(n - 1 - j);
      } else if (s[n - 1 - j] == '1') {
        e1[n - 1 - j].push_back(n + i);
        e1[n + i].push_back(n - 1 - j);
      }
    }
    int cnt = 0;
    b = vector<bool>(n + i + 2);
    res = true;
    dfs(n + i);
    dfs(n + i + 1);
    if (!res) continue;
    for (int j = 0; j < v.size(); j++) {
      if (b[j]) continue;
      v[j] = 1;
      dfs(j);
      if (!res) {
        cnt = -1;
        break;
      }
      cnt++;
    }
    if (cnt >= 0) ans = (ans + p[cnt]) % MOD;
  }
  cout << ans << '\n';
}
int main() {
  solve();
  return 0;
}