#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const double pi=4*atan(1.0); constexpr long long mod=static_cast(1e9+7); using cWeightEdges=vector>>; using cEdges=vector>; int main(){ string str; cin>>str; long long ans=0; queue>> Q; Q.push(make_tuple(0,0,vector(str.size(),false))); while(!Q.empty()){ auto now=Q.front(); Q.pop(); int index=get<0>(now); long long score=get<1>(now); vector vec=get<2>(now); if(str.size()<3 || index>(str.size()-3)){ ans=max(ans,score); } else{ if(!vec[index] && str[index]!='0'){ for(int i=index+1;i a=vec; a[index]=true; a[i]=true; a[j]=true; Q.push(make_tuple(index+1,score+tmp,a)); } } } } Q.push(make_tuple(index+1,score,vec)); } } cout<