#include <bits/stdc++.h>
using namespace std;
int i, j, k, m, n, p, u, x, a[1005], v[1005], w[1005];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  if (s[n - 1] == 49) {
    cout << 0;
    return 0;
  }
  for (s[n - 1] = 0; i < n; i++) s[i] &= 3;
  for (; ++k < n;) {
    for (i = 0; i < n; i++) v[i] = w[i] = 1;
    for (i = 0, p = 1; i < n; i++) {
      if (v[i]) {
        for (m = i, u = 0;;) {
          v[m] = 0;
          if (m == n - m - 1) {
            if (u < 0 || s[m] & 2) p = 2 * p % 998244353;
            break;
          }
          if (s[m] & 2)
            u = -1;
          else if (~u)
            u ^= s[m];
          m = n - m - 1;
          v[m] = 0;
          if (s[m] & 2 && u < 0) p = 2 * p % 998244353;
          if (m < n - k) {
            if (s[m] + u == 1) p = 0;
            break;
          }
          w[m] = 0;
          if (m == n + n - m - k - 1) {
            if (u < 0 || s[m] & 2) p = 2 * p % 998244353;
            break;
          }
          if (s[m] & 2)
            u = -1;
          else if (~u)
            u ^= s[m];
          m = n + n - m - k - 1;
          w[m] = 0;
          if (s[m] & 2 && u < 0) p = 2 * p % 998244353;
        }
      }
    }
    x = (x + p) % 998244353;
  }
  cout << x << '\n';
}
