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 INF = 1000 * 1000 * 1000;
const double PI = acos(-1.0);
const int MAX = 150005;
const int mod = 998244353;
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int mult(int a, int b) { return a * (long long)b % mod; }
int adder;
int used[2005];
vector<vector<pair<int, int> > > g(2005);
void dfs(int u) {
  for (auto v : g[u]) {
    if (used[v.first] == -1) {
      used[v.first] = used[u] ^ v.second;
      dfs(v.first);
    }
    if (used[v.first] != (used[u] ^ v.second)) adder = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int ans = 0;
  for (int len = 1; len < (int)(s.size()); len++) {
    for (int j = 0; j < 2 * (int)(s.size()); j++) g[j].clear();
    for (int j = 0; j < len; j++)
      g[j + (int)(s.size()) + (int)(s.size()) - len].push_back(
          {len - 1 - j + (int)(s.size()) + (int)(s.size()) - len, 0});
    for (int j = 0; j < (int)(s.size()); j++)
      g[j].push_back({(int)(s.size()) - j - 1, 0});
    for (int j = 0; j < (int)(s.size()); j++) {
      if (s[j] != '?') {
        g[j].push_back({j + (int)(s.size()), s[j] - '0'});
        g[j + (int)(s.size())].push_back({j, s[j] - '0'});
      }
    }
    adder = 1;
    memset(used, -1, sizeof used);
    for (int j = (int)(s.size()); j < 2 * (int)(s.size()) - len; j++) {
      if (used[j] == -1) {
        used[j] = 0;
        dfs(j);
      }
      if (used[j] == 1) adder = 0;
    }
    if (!used[2 * (int)(s.size()) - len]) adder = 0;
    if (used[2 * (int)(s.size()) - len] == -1) {
      used[2 * (int)(s.size()) - len] = 1;
      dfs(2 * (int)(s.size()) - len);
    }
    for (int j = 0; j < 2 * (int)(s.size()); j++)
      if (used[j] == -1) {
        used[j] = 0;
        dfs(j);
        adder = mult(adder, 2);
      }
    ans = add(ans, adder);
  }
  cout << ans;
}