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:
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
#define MOD 998244353

int poss[305][305][305],best[305][305],num[301];
LLI dp[305][305][305];
int main() {
    string S;
    cin >> S;

    int i,j,k;
    poss[0][0][0] = 1;
    for (i = S.size()-1; i >= 0; i--) num[i] = num[i+1]+(S[i] == '1');
    memset(best,-1,sizeof(best));
    for (i = 0; i <= S.size(); i++) {
        for (j = i; j >= 0; j--) {
            for (k = i; k >= 0; k--) {
                if (poss[i][j][k]) {
                    poss[i+2][j+(S[i] == '0')][k+(S[i] == '1')] = 1;
                    poss[i+2][j+(S[i+1] == '0')][k+(S[i+1] == '1')] = 1;
                    if (j > 0) poss[i+1][j+(S[i] == '0')-1][k+(S[i] == '1')] = 1;
                    if (k > 0) poss[i+1][j+(S[i] == '0')][k+(S[i] == '1')-1] = 1;
                    if (j+k > 0) poss[i+1][j][k] = 1;
                    if ((j+k > 1) && (j > 0)) poss[i][j-1][k] = 1;
                    if ((j+k > 1) && (k > 0)) poss[i][j][k-1] = 1;
                    best[j+S.size()-i-num[i]][k+num[i]] = max(best[j+S.size()-i-num[i]][k+num[i]],i);
                }
            }
        }
    }
    dp[S.size()][0][0] = 1;
    for (i = S.size(); i >= 0; i--) {
        for (j = 0; j <= S.size(); j++) {
            for (k = 0; k <= S.size(); k++) {
                if (i == S.size()) {
                    if (j > 0) dp[i][j][k] += dp[i][j-1][k];
                    if (k > 0) dp[i][j][k] += dp[i][j][k-1];
                }
                else {
                    dp[i][j][k] = dp[i+1][j][k];
                    if ((S[i] == '0') && (k > 0)) dp[i][j][k] += dp[i][j][k-1];
                    if ((S[i] == '1') && (j > 0)) dp[i][j][k] += dp[i][j-1][k];
                }
                dp[i][j][k] %= MOD;
            }
        }
    }
    LLI ans = 0;
    for (i = 0; i <= S.size(); i++) {
        for (j = 0; j <= S.size(); j++) {
            if (best[i][j] != -1) ans += dp[best[i][j]][i-(S.size()-best[i][j]-num[best[i][j]])][j-num[best[i][j]]];
        }
    }
    ans %= MOD;
    cout << ans << endl;

    return 0;
}