#!/usr/bin/python
# Author: Ivan Kazmenko (gassa@mail.ru)
# Stack solution
PROBLEM_NAME = 'bracket-expression'

fin  = open (PROBLEM_NAME + '.in',  'rt')
fout = open (PROBLEM_NAME + '.out', 'wt')
for s in fin:
	s = s.strip ()
	v = [1]
	for c in s:
		if c == '(':
			v += [1]
		elif c == ')':
			v[-2] *= v[-1] + 1
			v = v[:-1]
		else:
			assert False
	assert len (v) == 1
	fout.write ('{0}\n'.format (v[0]))
