//Arayi
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>

#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
    return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
    return (a * (a + 1LL)) / 2;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1, 0 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1, 0 };


const int N = 333;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-13;

lli bp(lli a, lli b = mod - 2LL)
{
    lli ret = 1;
    while (b)
    {
        if (b & 1) ret *= a, ret %= mod;
        a *= a;
        a %= mod;
        b >>= 1;
    }
    return ret;
}
ostream& operator<<(ostream& c, pir a)
{
    c << a.fr << " " << a.sc;
    return c;
}
struct pt
{
    lli x, y;
    int ind;
    int bl;
    bool operator==(const pt& a)
    {
        return ind == a.ind;
    }
    bool operator<(const pt& b)
    {
        if (x == b.x) return y < b.y;
        return x < b.x;
    }
};



int n;
str s;
bool dp[N][N][N], sm[N][N];
lli dp1[N][N][N], pat;
int z, m;
int main()
{
    fastio;
    cin >> s;
    n = s.length();
    dp[0][0][0] = true;
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                dp[i + 1][j][k] = dp[i][j][k];
                if (s[i] == '0' && j) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j - 1][k + 1];
                else if(s[i] == '1' && k) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j + 1][k - 1];
                if ((s[i] == '0' || s[i - 1] == '0') && j) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i - 1][j - 1][k];
                if ((s[i] == '1' || s[i - 1] == '1') && k) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i - 1][j][k - 1];
            }
        }
    }
    for (int i = 0; i <= n; i++)
        dp1[n][0][i] = dp1[n][i][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            dp1[n][i][j] = dp1[n][i - 1][j] + dp1[n][i][j - 1];
            dp1[n][i][j] %= mod;
        }
    }
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                if (s[i] == '1')
                {
                    if (j)
                        dp1[i][j][k] = dp1[i + 1][j][k] + dp1[i][j - 1][k];
                    else
                        dp1[i][j][k] = dp1[i + 1][j][k];
                }
                else
                {
                    if (k)
                        dp1[i][j][k] = dp1[i + 1][j][k] + dp1[i][j][k - 1];
                    else
                        dp1[i][j][k] = dp1[i + 1][j][k];
                }
                dp1[i][j][k] %= mod;
            }
        }
    }
    for (int i = n; i >= 0; i--)
    {
        if (i < n && s[i] == '0') z++;
        else if(i < n && s[i] == '1')m++;
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                if (!dp[i][j][k]) continue;
                if(sm[z + j][m + k]) continue;
                sm[z + j][m + k] = 1;
                pat += dp1[i][j][k];
                pat %= mod;
            }
        }

    }
    cout << pat << endl;
    return 0;
}

/*

  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/
### Prompt

Please formulate a Cpp solution to the following 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

### Response

```cpp
//Arayi
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>

#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
    return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
    return (a * (a + 1LL)) / 2;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1, 0 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1, 0 };


const int N = 333;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-13;

lli bp(lli a, lli b = mod - 2LL)
{
    lli ret = 1;
    while (b)
    {
        if (b & 1) ret *= a, ret %= mod;
        a *= a;
        a %= mod;
        b >>= 1;
    }
    return ret;
}
ostream& operator<<(ostream& c, pir a)
{
    c << a.fr << " " << a.sc;
    return c;
}
struct pt
{
    lli x, y;
    int ind;
    int bl;
    bool operator==(const pt& a)
    {
        return ind == a.ind;
    }
    bool operator<(const pt& b)
    {
        if (x == b.x) return y < b.y;
        return x < b.x;
    }
};



int n;
str s;
bool dp[N][N][N], sm[N][N];
lli dp1[N][N][N], pat;
int z, m;
int main()
{
    fastio;
    cin >> s;
    n = s.length();
    dp[0][0][0] = true;
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                dp[i + 1][j][k] = dp[i][j][k];
                if (s[i] == '0' && j) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j - 1][k + 1];
                else if(s[i] == '1' && k) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i][j + 1][k - 1];
                if ((s[i] == '0' || s[i - 1] == '0') && j) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i - 1][j - 1][k];
                if ((s[i] == '1' || s[i - 1] == '1') && k) dp[i + 1][j][k] = dp[i + 1][j][k] | dp[i - 1][j][k - 1];
            }
        }
    }
    for (int i = 0; i <= n; i++)
        dp1[n][0][i] = dp1[n][i][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            dp1[n][i][j] = dp1[n][i - 1][j] + dp1[n][i][j - 1];
            dp1[n][i][j] %= mod;
        }
    }
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                if (s[i] == '1')
                {
                    if (j)
                        dp1[i][j][k] = dp1[i + 1][j][k] + dp1[i][j - 1][k];
                    else
                        dp1[i][j][k] = dp1[i + 1][j][k];
                }
                else
                {
                    if (k)
                        dp1[i][j][k] = dp1[i + 1][j][k] + dp1[i][j][k - 1];
                    else
                        dp1[i][j][k] = dp1[i + 1][j][k];
                }
                dp1[i][j][k] %= mod;
            }
        }
    }
    for (int i = n; i >= 0; i--)
    {
        if (i < n && s[i] == '0') z++;
        else if(i < n && s[i] == '1')m++;
        for (int j = 0; j <= n; j++)
        {
            for (int k = 0; k <= n; k++)
            {
                if (!dp[i][j][k]) continue;
                if(sm[z + j][m + k]) continue;
                sm[z + j][m + k] = 1;
                pat += dp1[i][j][k];
                pat %= mod;
            }
        }

    }
    cout << pat << endl;
    return 0;
}

/*

  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/
```