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;
string s;
int m;
long long ans = 0;
vector<pair<int, int> > g[2006];
int vis[2006], cnt, has[2006];
int dfs(int x, int now) {
  vis[x] = now;
  has[x] = 1;
  bool ok = 1;
  for (int i = 0; i < g[x].size(); i++) {
    if (vis[g[x][i].first] != -1) {
      if (vis[g[x][i].first] != now ^ (g[x][i].second)) return 0;
    }
    if (!has[g[x][i].first]) ok &= dfs(g[x][i].first, now ^ (g[x][i].second));
  }
  return ok;
}
int main() {
  cin >> s;
  m = s.size();
  s = "0" + s;
  for (int i = 1; i < m; i++) {
    long long res = 1;
    memset(vis, -1, sizeof(vis));
    memset(has, 0, sizeof(has));
    for (int j = 0; j < 2006; j++) g[j].clear();
    for (int k = 1, j = m; k < j; k++, j--)
      g[k].push_back(make_pair(j, 0)), g[j].push_back(make_pair(k, 0));
    for (int k = 1, j = i; k < j; k++, j--)
      g[k + m].push_back(make_pair(j + m, 0)),
          g[j + m].push_back(make_pair(k + m, 0));
    for (int j = m - i + 1, k = 1; j <= m; j++, k++) {
      if (s[j] == '1')
        g[j].push_back(make_pair(k + m, 1)),
            g[k + m].push_back(make_pair(j, 1));
      if (s[j] == '0')
        g[j].push_back(make_pair(k + m, 0)),
            g[k + m].push_back(make_pair(j, 0));
    }
    for (int j = 1; j <= m - i; j++)
      if (s[j] != '?') vis[j] = s[j] - '0';
    vis[1 + m] = 1;
    if (!dfs(1 + m, 1)) res *= 0;
    for (int j = 1; j <= m - i && res > 0; j++)
      if (!has[j] && vis[j] != -1) {
        if (!dfs(j, vis[j])) res *= 0;
      }
    for (int j = 1; j <= m + i && res > 0; j++)
      if (!has[j]) {
        if (!dfs(j, 0))
          res = 0;
        else
          res = res * 2 % MOD;
      }
    ans = (ans + res) % MOD;
  }
  cout << ans;
}