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 <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,int k){
    Mint num(1),dom(1);
    for(int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}

//INSERT ABOVE HERE
using M = Mint<int, 998244353>;
const int MAX = 333;

int dp[MAX][MAX][MAX]={};
int ok[MAX][MAX][MAX]={};

M ct[MAX][MAX][MAX]={};

int zs[MAX]={};
int os[MAX]={};

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  string s;
  cin>>s;

  int n=s.size();
  for(int i=n-1;i>=0;i--){
    zs[i]=zs[i+1]+(s[i]=='0');
    os[i]=os[i+1]+(s[i]=='1');
  }

  dp[0][0][0]=1;
  for(int i=0;i<n;i++){
    for(int x=0;x+1<MAX;x++){
      for(int y=0;y+1<MAX;y++){
        // stock & current
        {
          int k=s[i]-'0';
          // drop current
          if(x+y>0) dp[i+1][x][y]|=dp[i][x][y];
          if(x>0) dp[i+1][x-1+(k==0)][y-0+(k==1)]|=dp[i][x][y];
          if(y>0) dp[i+1][x-0+(k==0)][y-1+(k==1)]|=dp[i][x][y];
        }

        if(i+1>=n) continue;

        // current & next
        {
          int p=s[i+0]-'0';
          int q=s[i+1]-'0';

          // use p
          dp[i+2][x+(p==0)][y+(p==1)]|=dp[i][x][y];
          dp[i+2][x+(p==0)][y+(p==1)]|=dp[i][x][y];

          // use q
          dp[i+2][x+(q==0)][y+(q==1)]|=dp[i][x][y];
          dp[i+2][x+(q==0)][y+(q==1)]|=dp[i][x][y];
        }
      }
    }
  }

  for(int i=0;i<=n;i++)
    for(int x=0;zs[i]+x<MAX;x++)
      for(int y=0;os[i]+y<MAX;y++)
        ok[i][zs[i]+x][os[i]+y]|=dp[i][x][y];

  const int DEBUG = 0;
  if(DEBUG){
    for(int i=0;i<=n;i++)
      for(int x=0;x<MAX;x++)
        for(int y=0;y<MAX;y++)
          if(ok[i][x][y]) cerr<<i<<' '<<x<<' '<<y<<endl;
  }

  for(int i=MAX-1;i>=0;i--){
    for(int x=MAX-1;x>=0;x--){
      for(int y=MAX-1;y>=0;y--){
        if(i) ok[i-1][x-0][y-0]|=ok[i][x][y];
        // if(x) ok[i-0][x-1][y-0]|=ok[i][x][y];
        // if(y) ok[i-0][x-0][y-1]|=ok[i][x][y];
      }
    }
  }

  ct[n][0][0]=M(1);
  for(int i=n;i>=0;i--){
    for(int x=0;x+1<MAX;x++){
      for(int y=0;y+1<MAX;y++){
        char c=i?s[i-1]:'?';
        ct[i-(c=='0')][x+1][y+0]+=ct[i][x][y];
        ct[i-(c=='1')][x+0][y+1]+=ct[i][x][y];
      }
    }
  }

  if(DEBUG){
    for(int i=0;i<=n;i++)
      for(int x=0;x<MAX;x++)
        for(int y=0;y<MAX;y++)
          if(ok[i][x][y]) cerr<<i<<' '<<x<<' '<<y<<':'<<ct[i][x][y]<<endl;
  }

  M ans{0};
  for(int i=0;i<=n;i++)
    for(int x=0;x<MAX;x++)
      for(int y=0;y<MAX;y++)
        if(ok[i][x][y]) ans+=ct[i][x][y];

  // empty
  //  ans-=M(1);

  cout<<ans<<newl;
  return 0;
}