#include #include std::string input; int numero = 0; long long rek(){ long long sum = 0; while (true){ std::string lulz = {input[numero], input[numero + 1]}; numero++; 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; // std::cout.flush(); // std::quick_exit(1); // } } } int main(){ std::ios_base::sync_with_stdio(false); int len; std::cin >> len >> input; long long total = rek(); while (numero + 1 < len) { numero ++; total *= rek(); } std::cout << total << std::endl; }