#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
inline long long read() {
  long long X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
long long mod = 998244353;
long long pw(long long x, long long y) {
  if (!y) return 1;
  if (y == 1) return x;
  long long mid = pw(x, y >> 1);
  if (y & 1) return 1ll * mid * mid % mod * x % mod;
  return 1ll * mid * mid % mod;
}
string s;
long long ans;
long long n;
vector<pair<long long, long long> > edg[10005];
long long col[100005];
bool vis[100005];
long long ok = 1;
void dfs(long long x, long long curcol) {
  if (vis[x]) {
    if (col[x] != curcol) {
      ok = false;
    }
    return;
  }
  vis[x] = 1;
  col[x] = curcol;
  for (long long i = 0; i < edg[x].size(); i++) {
    dfs(edg[x][i].first, curcol ^ edg[x][i].second);
  }
}
long long fuc() {
  ok = 1;
  long long con = 0;
  for (long long i = 0; i <= 2 * n + 1; i++) {
    if (!vis[i]) {
      dfs(i, 0);
      ++con;
    }
  }
  if (!ok) {
    return 0;
  }
  return pw(2, con - 1);
}
long long solve(long long m) {
  memset(vis, 0, sizeof vis);
  memset(col, -1, sizeof col);
  for (long long i = 0; i <= 2005; i++) {
    edg[i].clear();
  }
  for (long long i = 0; i < n; i++) {
    edg[i].push_back(make_pair(n - 1 - i, 0));
  }
  for (long long i = 0; i < m; i++) {
    edg[i + n].push_back(make_pair(n + (m - 1 - i), 0));
  }
  for (long long i = m; i < n; i++) {
    edg[i + n].push_back(make_pair(2 * n, 0));
    edg[2 * n].push_back(make_pair(i + n, 0));
  }
  for (long long i = 0; i < n; i++) {
    if (s[n - 1 - i] == '0') {
      edg[i].push_back(make_pair(i + n, 0));
      edg[i + n].push_back(make_pair(i, 0));
    } else if (s[n - 1 - i] == '1') {
      edg[i].push_back(make_pair(i + n, 1));
      edg[i + n].push_back(make_pair(i, 1));
    }
  }
  edg[2 * n].push_back(make_pair(2 * n + 1, 1));
  edg[2 * n + 1].push_back(make_pair(2 * n, 1));
  edg[n].push_back(make_pair(2 * n + 1, 0));
  edg[2 * n + 1].push_back(make_pair(n, 0));
  edg[0].push_back(make_pair(2 * n + 1, 0));
  edg[2 * n + 1].push_back(make_pair(0, 0));
  return fuc();
}
int main() {
  cin >> s;
  n = s.size();
  for (long long i = 1; i < n; i++) {
    ans = (ans + solve(i)) % mod;
  }
  cout << ans << endl;
  return 0;
}
