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;
string s;
vector<pair<int, int> > edges[2005];
int dp[2005];
bool bfs(int start) {
  assert(dp[start] < 2);
  queue<int> q;
  q.push(start);
  while (!q.empty()) {
    int curr = q.front();
    q.pop();
    for (pair<int, int> out : edges[curr]) {
      int nd = out.first;
      int nw = dp[curr] ^ out.second;
      if (dp[nd] == 2) {
        dp[nd] = nw;
        q.push(nd);
      } else if (dp[nd] != nw) {
        return false;
      }
    }
  }
  return true;
}
int solve(int len) {
  for (int i = 0; i < 2 * s.size(); i++) edges[i].clear();
  for (int i = 0; i < 2 * s.size(); i++) {
    dp[i] = 2;
  }
  for (int i = 0; i < s.size(); i++) {
    edges[i].push_back({s.size() - 1 - i, 0});
  }
  for (int i = 0; i < len; i++) {
    int j = len - 1 - i;
    int si = i + s.size();
    int sj = j + s.size();
    edges[si].push_back({sj, 0});
    edges[sj].push_back({si, 0});
  }
  int comps = 0;
  {
    int match = s.size() - 1;
    for (int i = len - 1; i >= 0; i--) {
      if (s[match] == '0') {
        edges[match].push_back({i + s.size(), 0});
        edges[i + s.size()].push_back({match, 0});
      } else if (s[match] == '1') {
        edges[match].push_back({i + s.size(), 1});
        edges[i + s.size()].push_back({match, 1});
      }
      match--;
    }
  }
  dp[s.size()] = 1;
  if (!bfs(s.size())) return 0;
  if (dp[0] == 0) return 0;
  dp[0] = 1;
  if (!bfs(0)) return 0;
  for (int i = 0; i + len < s.size(); i++) {
    if (s[i] == '0') {
      if (dp[i] == 1) return 0;
      dp[i] = 0;
      if (!bfs(i)) return 0;
    } else if (s[i] == '1') {
      if (dp[i] == 0) return 0;
      dp[i] = 1;
      if (!bfs(i)) return 0;
    }
  }
  long long ret = 1;
  for (int i = 0; i < s.size() + len; i++) {
    if (dp[i] != 2) continue;
    dp[i] = 0;
    ret *= 2;
    ret %= MOD;
    if (!bfs(i)) return 0;
  }
  return ret;
}
void solve() {
  cin >> s;
  long long ret = 0;
  for (int len = 1; len <= s.size(); len++) {
    ret += solve(len);
    ret %= MOD;
  }
  cout << ret << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}