#include using namespace std; using ll = long long; int main(){ vector ndp(1<<17,0); ndp[1] = 2; int no = -1; for(int i = 2;i<1<<17;i++){ ndp[i] = 2 * ndp[i-1] + 1; if(ndp[i]>1e18){ no = i; break; } } string s; cin>>s; ll ans = 0; int n = s.size(); vector need(n+1,0); stack st; set ss; bool ok = false; vector dp(n+1,0); for(int i = n-1;i>=0;i--){ if(s[i]==')'){ st.push(i); continue; } if(st.empty()){ ok = true; if(i+1==n) ans = 1; else ans = dp[i+1] + 1; break; } int ni = st.top(); st.pop(); if(ni==i+1){ dp[i] = 1; ss.insert(i); if(st.empty()) ans += dp[i]; ans = min(ans,(ll)2e18); continue; } ll sum = 0; while(ss.size()){ auto itr = ss.begin(); int nk = *itr; if(nk>ni) break; sum += dp[nk]; sum = min(sum,(ll)2e18); ss.erase(nk); } if(sum>=no){ dp[i] = 2e18; } if(sum