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;
using lli = long long int;
using vb = vector<bool>;
using vc = vector<char>;
using vd = vector<double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vlli = vector<lli>;
using vvlli = vector<vlli>;
using pi = pair<int, int>;
using plli = pair<lli, lli>;
void readc(char &q) { scanf("%c", &q); }
char readc() {
  char q;
  scanf("%c", &q);
  return q;
}
void readint(int &q) { scanf("%d", &q); }
int readint() {
  int q;
  scanf("%d", &q);
  return q;
}
void readlong(lli &q) { scanf("%lld", &q); }
lli readlong() {
  lli q;
  scanf("%lld", &q);
  return q;
}
void readdbl(double &q) { scanf("%lf", &q); }
double readdbl() {
  double q;
  scanf("%lf", &q);
  return q;
}
void printint(int q) { printf("%d", q); }
void printlong(lli q) { printf("%lld", q); }
void printdbl(double q, int p = 6) { printf("%.*lf", p, q); }
void readln() { scanf("\n"); }
void println() { printf("\n"); }
void printsp() { printf(" "); }
void print(int q) { printint(q); }
void print(long q) { printlong((lli)q); }
void print(lli q) { printlong(q); }
void print(double q) { printdbl(q); }
void print(char c) { printf("%c", c); }
void print(pi q) {
  print(q.first);
  printsp();
  print(q.second);
}
void print(vi q) {
  for (int i = 0; i < q.size(); ++i) {
    print(q[i]);
    printsp();
  }
}
void print(vlli q) {
  for (int i = 0; i < q.size(); ++i) {
    print(q[i]);
    printsp();
  }
}
void print(vd q) {
  for (int i = 0; i < q.size(); ++i) {
    print(q[i]);
    printsp();
  }
}
template <typename T>
void println(T q) {
  print(q);
  println();
}
template <typename T>
T maxim(T first, T second) {
  return (first > second) ? first : second;
}
template <typename T>
T maxim(T first, T second, T third) {
  return mndlim(maxim(first, second), third);
}
template <typename T>
T minim(T first, T second) {
  return (first < second) ? first : second;
}
template <typename T>
T minim(T first, T second, T third) {
  return minim(minim(first, second), third);
}
template <typename T>
T middle(T first, T second, T third) {
  return first + second + third - maxim(first, second, third) -
         minim(first, second, third);
}
template <typename T>
T abs(T arg) {
  return arg < 0 ? -arg : arg;
}
const lli modulo = 1000000007;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n / 2; ++i) {
    char c = s[i];
    s[i] = s[n - 1 - i];
    s[n - 1 - i] = c;
  }
  lli res = 0ll;
  for (lli k = 0; k < n; ++k) {
    vi a(n, -1);
    vi b(n, -1);
    if (k == 0) continue;
    a[k - 1] = 1;
    for (int i = 0; i < n - k; ++i) {
      a[k + i] = 0;
    }
    b[n - 1] = 1;
    bool changed = true;
    bool controversy = false;
    while (changed) {
      changed = false;
      for (int i = 0; i < n; ++i) {
        if (s[i] != '?') {
          if (a[i] != -1 && b[i] != -1) {
            if (a[i] ^ b[i] != s[i] - '0') {
              controversy = true;
              break;
            }
          } else if (a[i] != -1) {
            b[i] = a[i] ^ (s[i] - '0');
            changed = true;
          } else if (b[i] != -1) {
            a[i] = b[i] ^ (s[i] - '0');
            changed = true;
          }
        }
      }
      for (int i = 0; i < n / 2; ++i) {
        if (b[i] != -1 && b[n - 1 - i] != -1) {
          if (b[i] != b[n - 1 - i]) {
            controversy = true;
            break;
          }
        } else if (b[i] != -1) {
          b[n - i - 1] = b[i];
          changed = true;
        } else if (b[n - 1 - i] != -1) {
          b[i] = b[n - 1 - i];
          changed = true;
        }
      }
      for (int i = 0; i < k / 2; ++i) {
        if (a[i] != -1 && a[k - 1 - i] != -1) {
          if (a[i] != a[k - 1 - i]) {
            controversy = true;
            break;
          }
        } else if (a[i] != -1) {
          a[k - i - 1] = a[i];
          changed = true;
        } else if (a[k - 1 - i] != -1) {
          a[i] = a[k - 1 - i];
          changed = true;
        }
      }
      if (controversy) {
        break;
      }
    }
    if (controversy) continue;
    vi d(2 * n);
    for (int i = 0; i < n; ++i) {
      d[i] = b[i];
      d[n + i] = a[i];
    }
    vb used(2 * n, false);
    vector<vector<pi>> g(2 * n);
    for (int i = 0; i < n; ++i) {
      g[i].push_back(make_pair(n + i, s[i] == '?' ? 2 : s[i] - '0'));
      g[n + i].push_back(make_pair(i, s[i] == '?' ? 2 : s[i] - '0'));
      if (i * 2 + 1 != n) {
        g[i].push_back(make_pair(n - 1 - i, 0));
      }
      if (i < k) {
        if (i * 2 + 1 != k) {
          g[n + i].push_back(make_pair(n + k - 1 - i, 0));
        }
      }
    }
    int cur_degree = 0;
    for (int i = 0; i < 2 * n; ++i) {
      if (!used[i]) {
        if (g[i].size() == 1) {
          int prev = i;
          used[prev] = true;
          int cur = g[i][0].first;
          int leg = g[i][0].second;
          if (d[prev] == -1) cur_degree++;
          while (!used[cur]) {
            used[cur] = true;
            if (d[cur] == -1) {
              if (leg == 2) cur_degree++;
            } else if (d[prev] == -1) {
            }
            if (g[cur].size() == 1) break;
            if (g[cur][0].first != prev) {
              prev = cur;
              cur = g[cur][0].first;
              leg = g[cur][0].second;
            } else {
              prev = cur;
              cur = g[cur][1].first;
              leg = g[cur][1].second;
            }
          }
        }
      }
    }
    lli curcount = 1ll;
    while (cur_degree--) {
      curcount *= 2;
      if (curcount >= 998244353) curcount -= 998244353;
    }
    res += curcount;
    if (res >= 998244353) res -= 998244353;
  }
  cout << res << endl;
  return 0;
}