#include int parexpr(int dep) { char c; int val = 0; do { c = getchar(); if (c == '(') { dep++; if (!val) { val = 1; } val *= parexpr(dep); } if (c == ')') { dep--; return val + 1; } } while (dep && c != '\n'); return val; } int main(void) { int n; int cookies = 0; char seq[2] = "\0\0"; scanf("%d ", &n); cookies = parexpr(NULL); printf("%d\n", cookies); return 0; }