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 long long mod = 998244353;
vector<int> f;
int dfs(int vr, int col, vector<vector<pair<int, int> > >& g) {
  f[vr] = col;
  int siz = 0;
  for (pair<int, int> i : g[vr]) {
    if (f[i.first] == -1) {
      siz = min(siz, dfs(i.first, col ^ i.second, g));
    }
    if ((col ^ i.second) != f[i.first]) {
      return -1;
    }
  }
  return siz;
}
long long zostroj_graf(string s, int dl) {
  int n = s.size();
  vector<vector<pair<int, int> > > g(n + dl + 2);
  for (int i = 0; i < n / 2; i++) {
    g[i].push_back({n - 1 - i, 0});
    g[n - 1 - i].push_back({i, 0});
  }
  int zero = g.size() - 2;
  int one = g.size() - 1;
  int zac = n - dl;
  for (int i = 0; i < zac; i++) {
    if (s[i] == '0') {
      g[zero].push_back({i, 0});
      g[i].push_back({zero, 0});
    }
    if (s[i] == '1') {
      g[one].push_back({i, 0});
      g[i].push_back({one, 0});
    }
  }
  for (int i = 0; i < dl / 2; i++) {
    g[n + i].push_back({n + dl - i - 1, 0});
    g[n + dl - i - 1].push_back({n + i, 0});
  }
  g[one].push_back({n, 0});
  g[n].push_back({one, 0});
  for (int i = zac; i < n; i++) {
    if (s[i] == '0') {
      g[i].push_back({n + i - zac, 0});
      g[n + i - zac].push_back({i, 0});
    }
    if (s[i] == '1') {
      g[i].push_back({n + i - zac, 1});
      g[n + i - zac].push_back({i, 1});
    }
  }
  f.clear();
  f.resize(g.size(), -1);
  long long ans = 1;
  if (dfs(zero, 0, g) == -1) {
    return 0;
  }
  if (dfs(one, 1, g) == -1) {
    return 0;
  }
  for (int i = 0; i < n + dl; i++) {
    if (f[i] == -1) {
      int d = dfs(i, 0, g);
      if (d == -1) {
        return 0;
      }
      ans <<= 1ll;
      if (ans > mod) {
        ans -= mod;
      }
    }
  }
  return ans;
}
int main() {
  string s;
  cin >> s;
  long long ans = 0;
  for (int i = 1; i < s.size(); i++) {
    ans += zostroj_graf(s, i);
    if (ans > mod) {
      ans -= mod;
    }
  }
  cout << ans << "\n";
  return 0;
}