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;
int id1[1005], id2[1005];
vector<pair<int, int> > nei[3005];
int co[3005];
bool flag;
void dfs(int v, int col) {
  if (~co[v] && co[v] != col) {
    flag = 1;
    return;
  } else if (~co[v])
    return;
  co[v] = col;
  for (int i = 0; i < nei[v].size(); i++) {
    int u = nei[v][i].first, c = nei[v][i].second;
    dfs(u, col ^ c);
  }
}
const long long MOD = 998244353;
int main() {
  string s;
  cin >> s;
  int cnt = 1;
  for (int i = 0; i < s.size(); i++) {
    id1[i] = cnt++;
  }
  long long res = 0;
  for (int i = 0; i < (int)s.size() - 1; i++) {
    memset(co, -1, sizeof co);
    flag = 0;
    int tcnt = cnt;
    for (int j = 0; j < 2 * (int)s.size(); j++) nei[j].clear();
    for (int j = 0; j <= i; j++) {
      id2[j] = tcnt++;
      if (s[j] != '?') {
        nei[id1[j]].push_back(make_pair(id2[j], s[j] - '0'));
        nei[id2[j]].push_back(make_pair(id1[j], s[j] - '0'));
      }
    }
    nei[0].push_back(make_pair(id2[i], 1));
    for (int j = i + 1; j < s.size(); j++) {
      if (s[j] != '?') nei[0].push_back(make_pair(id1[j], s[j] - '0'));
    }
    for (int j = 0; j < (i + 1) / 2; j++) {
      nei[id2[j]].push_back(make_pair(id2[i - j], 0));
      nei[id2[i - j]].push_back(make_pair(id2[j], 0));
    }
    for (int j = 0; j < (int)s.size() / 2; j++) {
      nei[id1[j]].push_back(make_pair(id1[(int)s.size() - j - 1], 0));
      nei[id1[(int)s.size() - j - 1]].push_back(make_pair(id1[j], 0));
    }
    dfs(0, 0);
    long long dif = 1;
    for (int j = 1; j < tcnt; j++) {
      if (co[j] == -1) {
        dfs(j, 0);
        dif *= 2;
        if (dif >= MOD) dif -= MOD;
      }
    }
    if (!flag) res += dif;
    if (res >= MOD) res -= MOD;
  }
  cout << res;
}