/* #include void self::main(){ STR(s); ll N=s.size(); vecpos(N,-1); vecst; fo(i,N){ if(s[i]=='('){ st.eb(i); }else if(s[i]==')'){ ll j=st.pop_back(); pos[i]=j; pos[j]=i; } } auto dfs=[&](this auto self,ll l,ll r)->ll{ if(l>r)return 0; if(l==r)return s[l]-'0'; if(s[l]=='('&&s[r]==')')return self(l+1,r-1); ll res=0; if(in('0',s[l],'9'+1)){ ll x=s[l]-'0'; res=x+self(l+1,r); } else if(s[l]=='('){ ll x=self(l,pos[l]); res=x+self(pos[l]+1,r); } else{ if(in('0',s[l+1],'9'+1)){ ll x=s[l+1]-'0'; if(s[l]=='-')x=-x; res=x+self(l+2,r); } else if(s[l+1]=='('){ ll x=self(l+1,pos[l+1]); if(s[l]=='-')x=-x; res=x+self(pos[l+1]+2,r); } } return res; }; pp(dfs(0,N-1)); } */ #include using namespace std; namespace self{void main();void sub();templatevoid pp(const auto&...a);void epp(const auto&...a);} int main(){cin.tie(nullptr)->sync_with_stdio(0);cout<(0,__VA_ARGS__);iconstexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} void lin(auto&...a){(cin>>...>>a);} bool in(auto l,auto m,auto r){return l<=m&&musing pack_back_t=tuple_element_t>; } namespace self{ templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ using vector::vector; auto&emplace_back(auto&&...a){vector::emplace_back(std::forward(a)...);return*this;} auto pop_back(){auto r=this->back();vector::pop_back();return r;} }; templaterequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; } namespace self{ struct str:string{ str()=default; ll size()const{return string::size();} }; } templatevoid self::pp(const auto&...a){const char*c="";((o<pos(N,-1); vecst; fo(i,N){ if(s[i]=='('){ st.eb(i); }else if(s[i]==')'){ ll j=st.pop_back(); pos[i]=j; pos[j]=i; } } auto dfs=[&](this auto self,ll l,ll r)->ll{ if(l>r)return 0; if(l==r)return s[l]-'0'; if(s[l]=='('&&s[r]==')')return self(l+1,r-1); ll res=0; if(in('0',s[l],'9'+1)){ ll x=s[l]-'0'; res=x+self(l+1,r); } else if(s[l]=='('){ ll x=self(l,pos[l]); res=x+self(pos[l]+1,r); } else{ if(in('0',s[l+1],'9'+1)){ ll x=s[l+1]-'0'; if(s[l]=='-')x=-x; res=x+self(l+2,r); } else if(s[l+1]=='('){ ll x=self(l+1,pos[l+1]); if(s[l]=='-')x=-x; res=x+self(pos[l+1]+2,r); } } return res; }; pp(dfs(0,N-1)); }