#define IO_FILES
#include <cassert>
#include <cstdio>
#include <cstring>

#define PROBLEM_NAME "bracket-expression"

int const MAX_N = 40;

int main (void)
{
#ifdef IO_FILES
	freopen (PROBLEM_NAME ".in",  "rt", stdin);
	freopen (PROBLEM_NAME ".out", "wt", stdout);
#endif

        char s [MAX_N + 3];
	while (fgets (s, sizeof (s), stdin) != NULL)
	{
		int n = strlen (s);
		while (n > 0 && s[n - 1] < 32)
		{
			n--;
		}
		int v [MAX_N];
		int p = 0;
		v[p] = 1;
		p++;
		for (int i = 0; i < n; i++)
		{
			switch (s[i])
			{
				case '(':
					v[p] = 1;
					p++;
					break;
				case ')':
					p--;
					v[p - 1] *= v[p] + 1;
					break;
				default:
					assert (false);
					break;
			}
		}
		assert (p == 1);
		printf ("%d\n", v[0]);
	}
	return 0;
}
