#include #include std::string input; int index = 0; long long rek(){ long long sum = 0; while (true){ std::string lulz = {input[index], input[index + 1]}; index++; if (lulz == "((") sum += rek(); else if (lulz == "))") return sum + 1; else if (lulz == "()") return 1; else if (lulz == ")(") sum *= rek(); else std::cout << "WTFFFFFF " << lulz; } } int main(){ std::ios_base::sync_with_stdio(false); std::cin >> index >> input; index = 0; std::cout << rek() << std::endl; }