Problem: Given is a string S consisting of `0` and `1`. Find the number of strings, modulo 998244353, that can result from applying the following operation on S zero or more times:

* Remove the two characters at the beginning of S, erase one of them, and reinsert the other somewhere in S. This operation can be applied only when S has two or more characters.

Constraints

* 1 \leq |S| \leq 300
* S consists of `0` and `1`.

Input

Input is given from Standard Input in the following format:


S


Output

Print the number of strings, modulo 998244353, that can result from applying the operation on S zero or more times.

Examples

Input

0001


Output

8


Input

110001


Output

24


Input

11101111011111000000000110000001111100011111000000001111111110000000111111111


Output

697354558

Solution (in CPP):

Solution:
#include <iostream>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;

const int MOD = 998244353; // change if needed

struct Modint {
  ll val;
  
  Modint (ll _val = 0)
    : val(_val % MOD) {}

  Modint operator+ (Modint other) const {
    return Modint(val + other.val);
  }

  void operator+= (Modint other) {
    val += other.val;
    val %= MOD;
  }

  Modint operator- () const {
    return Modint(MOD - val);
  }

  Modint operator- (Modint other) const {
    return Modint(val + MOD - other.val);
  }

  void operator-= (Modint other) {
    val += MOD - other.val;
    val %= MOD;
  }

  Modint operator* (Modint other) const {
    return Modint(val * other.val);
  }

  void operator*= (Modint other) {
    val *= other.val;
    val %= MOD;
  }

  bool operator== (Modint other) const {
    return val == other.val;
  }

  bool operator!= (Modint other) const {
    return val != other.val;
  }
};

Modint exp (Modint a, int k) {
  if (k == 0) {
    return Modint(1);
  } else if (k % 2 == 0) {
    Modint half = exp(a, k / 2);
    return half * half;
  } else {
    return a * exp(a, k - 1);
  }
}

Modint inv (Modint a) {
  return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
  out << p.val;
  return out;
}

const int MAX_N = 305;
const int MAX_X = 155;

Modint dp [MAX_N][MAX_N][MAX_N];
int arr [MAX_N];
bitset<MAX_X> pdp [MAX_N][MAX_N][MAX_N];
// <position, # taken, # 0>

int main () {
  string s;
  cin >> s;

  int n = s.size();
  for (int i = 0; i < n; i++) {
    arr[i] = s[i] - '0';
  }

  dp[0][n][0] = Modint(1);
  for (int i = 0; i < n; i++) {
    for (int j = n; j >= 1; j--) {
      for (int k = 0; k < n; k++) {
        if (arr[j - 1] == 0) {
          dp[i + 1][j - 1][k] += dp[i][j][k];
          dp[i + 1][j][k] += dp[i][j][k];
        } else {
          dp[i + 1][j - 1][k] += dp[i][j][k];
          dp[i + 1][j][k + 1] += dp[i][j][k];
        }
      }
    }
  }

  pdp[0][0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if (pdp[i][j][k].any()) {
          pdp[i + 1][j][k] |= pdp[i][j][k];
          pdp[i + 2][j][k] |= pdp[i][j][k] << 1;
          pdp[i + 2][j + 1][k + (arr[i] == 0)] |= pdp[i][j][k];
          pdp[i + 2][j + 1][k + (arr[i + 1] == 0)] |= pdp[i][j][k];
          pdp[i + 1][j + 1][k + (arr[i] == 0)] |= pdp[i][j][k] >> 1;
        }
      }
    }
  }
  
  Modint ans (0);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= n; k++) {
        if (pdp[i][j][k].any()) {
          // cerr << " " << i << " " << k << " " << j - k << " | " << dp[n - i + j][i][k] << endl;
          ans += dp[n - i + j][i][k];
        }
      }
    }
  }

  cout << ans - Modint(1) << endl;
}