#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305,mod=998244353;
int n;
char s[N];
int dp[N][N][N];
bool f[N][N][N];
int main()
{
    scanf("%s",s);
    n=strlen(s);
    f[0][0][0]=true;
    for(int i=0;i<n;i++)
        for(int n0=0;n0<=i;n0++)
        for(int n1=0;n1<=i;n1++)
    {
        if(!f[i][n0][n1]) continue;
        f[i+1][n0][n1]=true;
        if(n0)
        {
            int nn0=n0-1+(s[i]=='0');
            int nn1=n1+(s[i]=='1');
            f[i+1][nn0][nn1]=true;
        }
        if(n1)
        {
            int nn0=n0+(s[i]=='0');
            int nn1=n1-1+(s[i]=='1');
            f[i+1][nn0][nn1] = true;
        }
        if(i+1<n)
        {
            f[i+2][n0+(s[i]=='0')][n1+(s[i] == '1')] = true;
            f[i+2][n0+(s[i+1]=='0')][n1+(s[i+1] == '1')] = true;
        }
    }
    dp[n][0][0]=1;
    ll ans=0;
    for(int i=n;i>=0;i--)
        for(int n0=0;n0<=n;n0++)
        for(int n1=0;n1<=n;n1++)
    {
        if(dp[i][n0][n1]==0) continue;
        if(f[i][n0][n1])
            ans=(ans+dp[i][n0][n1])%mod;
        if(i>0)
        {
            dp[i-1][n0][n1]=(dp[i-1][n0][n1]+dp[i][n0][n1])%mod;
            if(s[i-1]=='1')
                dp[i][n0+1][n1]=(dp[i][n0+1][n1]+dp[i][n0][n1])%mod;
            else
                dp[i][n0][n1+1]=(dp[i][n0][n1+1]+dp[i][n0][n1])%mod;
        }
    }
    ans=(ans+mod-1)%mod;
    printf("%lld\n",ans);
}

### Prompt

Generate 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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305,mod=998244353;
int n;
char s[N];
int dp[N][N][N];
bool f[N][N][N];
int main()
{
    scanf("%s",s);
    n=strlen(s);
    f[0][0][0]=true;
    for(int i=0;i<n;i++)
        for(int n0=0;n0<=i;n0++)
        for(int n1=0;n1<=i;n1++)
    {
        if(!f[i][n0][n1]) continue;
        f[i+1][n0][n1]=true;
        if(n0)
        {
            int nn0=n0-1+(s[i]=='0');
            int nn1=n1+(s[i]=='1');
            f[i+1][nn0][nn1]=true;
        }
        if(n1)
        {
            int nn0=n0+(s[i]=='0');
            int nn1=n1-1+(s[i]=='1');
            f[i+1][nn0][nn1] = true;
        }
        if(i+1<n)
        {
            f[i+2][n0+(s[i]=='0')][n1+(s[i] == '1')] = true;
            f[i+2][n0+(s[i+1]=='0')][n1+(s[i+1] == '1')] = true;
        }
    }
    dp[n][0][0]=1;
    ll ans=0;
    for(int i=n;i>=0;i--)
        for(int n0=0;n0<=n;n0++)
        for(int n1=0;n1<=n;n1++)
    {
        if(dp[i][n0][n1]==0) continue;
        if(f[i][n0][n1])
            ans=(ans+dp[i][n0][n1])%mod;
        if(i>0)
        {
            dp[i-1][n0][n1]=(dp[i-1][n0][n1]+dp[i][n0][n1])%mod;
            if(s[i-1]=='1')
                dp[i][n0+1][n1]=(dp[i][n0+1][n1]+dp[i][n0][n1])%mod;
            else
                dp[i][n0][n1+1]=(dp[i][n0][n1+1]+dp[i][n0][n1])%mod;
        }
    }
    ans=(ans+mod-1)%mod;
    printf("%lld\n",ans);
}

```