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;
template <typename T>
void maxtt(T &t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T &t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "URDL";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
char s[2135];
int f[2135];
int ff(int x) { return x == f[x] ? x : f[x] = ff(f[x]); }
vector<pair<int, int> > vp[2];
vector<int> mp[2135];
map<int, int> mpi;
int N, col[2135], Ans;
int gid(int x) {
  if (mpi.find(x) == mpi.end()) mpi[x] = ++N;
  return mpi[x];
  ;
}
bool dfs(int x, int C) {
  col[x] = C;
  for (int v : mp[x]) {
    if (col[v] == 0) {
      if (!dfs(v, 3 - C)) return 0;
      ;
    } else if (col[v] != 3 - C)
      return 0;
  }
  return 1;
}
void cal(int st) {
  for (int(i) = 1; (i) <= (int)(n + n + 2); (i)++) f[i] = i;
  for (int(z) = 0; (z) < (int)(2); (z)++) vp[z].clear();
  int n0 = n + n + 1, n1 = n + n + 2;
  vp[1].push_back({n0, n1});
  for (int i = 1, j = n; i < j; i++, j--) {
    vp[0].push_back({i, j});
  }
  vp[0].push_back({1, n1});
  for (int i = st, j = n; i < j; i++, j--) {
    vp[0].push_back({n + i, n + j});
  }
  for (int i = 1; i < st; i++) vp[0].push_back({n + i, n0});
  vp[0].push_back({n + st, n1});
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    if (s[i] == '1') {
      vp[1].push_back({i, n + i});
    } else if (s[i] == '0')
      vp[0].push_back({i, n + i});
  for (auto &p : vp[0]) {
    int u = p.first, v = p.second;
    int fx = ff(u), fv = ff(v);
    if (fx == fv) continue;
    f[fx] = fv;
  }
  mpi.clear();
  N = 0;
  for (int(i) = 1; (i) <= (int)(n + n + 2); (i)++) gid(ff(i));
  for (int(i) = 1; (i) <= (int)(N); (i)++) {
    mp[i].clear();
    col[i] = 0;
  }
  for (auto &p : vp[1]) {
    int u = p.first, v = p.second;
    int fx = ff(u), fv = ff(v);
    if (fx == fv) return;
    fx = gid(fx);
    fv = gid(fv);
    mp[fx].push_back(fv);
    mp[fv].push_back(fx);
  }
  int cc = 0;
  for (int(i) = 1; (i) <= (int)(N); (i)++)
    if (col[i] == 0) {
      if (!dfs(i, 1)) return;
      cc++;
    }
  addmod(Ans, fastPow(2, cc - 1));
}
void fmain(int tid) {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 2; i <= n; i++) cal(i);
  printf("%d\n", Ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}